Need to restrict mouser hover effect on touch action

Magesh Sankar 31 Reputation points
2020-06-04T18:13:01.827+00:00

I have an custom calendar control, I have highlighted day cell on mouser over, I need to restrict the mouse hover color applied to day cell when perform touch action in calendar.Please provide any suggestions on this.

c# wpf touch

Windows Presentation Foundation
Windows Presentation Foundation
A part of the .NET Framework that provides a unified programming model for building line-of-business desktop applications on Windows.
2,669 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. DaisyTian-1203 11,616 Reputation points
    2020-06-05T07:46:43.727+00:00

    You can set CalendarDayButton's style for Calendar in the style , do not include the MouseOver state in the CommonStates under the VisualStateGroup like the below code show:

    <VisualStateGroup Name="CommonStates">
                  <VisualStateGroup.Transitions>
                    <VisualTransition GeneratedDuration="0:0:0.1" />
                  </VisualStateGroup.Transitions>
                  <VisualState Name="Normal" />
                  <VisualState Name="Pressed">
                    <Storyboard>
                      <DoubleAnimation Storyboard.TargetName="HighlightBackground"
                                       Storyboard.TargetProperty="Opacity"
                                       To="0.5"
                                       Duration="0" />
                    </Storyboard>
                  </VisualState>
                  <VisualState Name="Disabled">
                    <Storyboard>
                      <DoubleAnimation Storyboard.TargetName="HighlightBackground"
                                       Storyboard.TargetProperty="Opacity"
                                       To="0"
                                       Duration="0" />
                      <DoubleAnimation Storyboard.TargetName="NormalText"
                                       Storyboard.TargetProperty="Opacity"
                                       To=".35"
                                       Duration="0" />
                    </Storyboard>
                  </VisualState>
                </VisualStateGroup>