码迷,mamicode.com
首页 > 其他好文 > 详细

UWP 滚动条私人定制

时间:2018-01-17 00:21:41      阅读:195      评论:0      收藏:0      [点我收藏+]

标签:等等   vertica   tabs   row   listview   disabled   type   min   image   

最近突然发现微软自带的滚动条好挫哦

 

微软哒(棒棒哒)

 技术分享图片

 

 

网上找的(美美哒)

技术分享图片

 

 

好了。

如果你想要棒棒哒,那么就不用往下看了(手动再见)。

如果你想要美美哒,就需要下面的神秘代码。

 

技术分享图片

 

    <Style TargetType="ScrollBar">
        <Setter Property="MinWidth" Value="12" />
        <Setter Property="MinHeight" Value="12" />
        <Setter Property="Background" Value="Transparent" />
        <Setter Property="Foreground" Value="Transparent" />
        <Setter Property="BorderBrush" Value="Transparent" />
        <Setter Property="IsTabStop" Value="False" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ScrollBar">
                    <Grid x:Name="Root">
                        <Grid.Resources>
                            <ControlTemplate x:Key="RepeatButtonTemplate" TargetType="RepeatButton">
                                <Grid x:Name="Root" Background="Transparent">
                                    <VisualStateManager.VisualStateGroups>
                                        <VisualStateGroup x:Name="CommonStates">
                                            <VisualState x:Name="Normal" />
                                        </VisualStateGroup>
                                    </VisualStateManager.VisualStateGroups>
                                </Grid>
                            </ControlTemplate>
                            <ControlTemplate x:Key="HorizontalIncrementTemplate" TargetType="RepeatButton">
                                <Grid x:Name="Root">
                                    <FontIcon
                                        x:Name="Arrow"
                                        FontFamily="{ThemeResource SymbolThemeFontFamily}"
                                        FontSize="6"
                                        Foreground="{ThemeResource SystemControlForegroundBaseHighBrush}"
                                        Glyph="&#xE0E3;"
                                        MirroredWhenRightToLeft="True" />
                                    <VisualStateManager.VisualStateGroups>
                                        <VisualStateGroup x:Name="CommonStates">
                                            <VisualState x:Name="Normal" />
                                            <VisualState x:Name="PointerOver">
                                                <Storyboard>
                                                    <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Root" Storyboard.TargetProperty="Background">
                                                        <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlHighlightBaseMediumLowBrush}" />
                                                    </ObjectAnimationUsingKeyFrames>
                                                    <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Arrow" Storyboard.TargetProperty="Foreground">
                                                        <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlHighlightAltBaseHighBrush}" />
                                                    </ObjectAnimationUsingKeyFrames>
                                                </Storyboard>
                                            </VisualState>
                                            <VisualState x:Name="Pressed">
                                                <Storyboard>
                                                    <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Root" Storyboard.TargetProperty="Background">
                                                        <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlHighlightBaseMediumBrush}" />
                                                    </ObjectAnimationUsingKeyFrames>
                                                    <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Arrow" Storyboard.TargetProperty="Foreground">
                                                        <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlHighlightAltAltHighBrush}" />
                                                    </ObjectAnimationUsingKeyFrames>
                                                </Storyboard>
                                            </VisualState>
                                            <VisualState x:Name="Disabled">
                                                <Storyboard>
                                                    <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Arrow" Storyboard.TargetProperty="Foreground">
                                                        <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlDisabledBaseHighBrush}" />
                                                    </ObjectAnimationUsingKeyFrames>
                                                </Storyboard>
                                            </VisualState>
                                        </VisualStateGroup>
                                    </VisualStateManager.VisualStateGroups>
                                </Grid>
                            </ControlTemplate>
                            <ControlTemplate x:Key="HorizontalDecrementTemplate" TargetType="RepeatButton">
                                <Grid x:Name="Root">
                                    <FontIcon
                                        x:Name="Arrow"
                                        FontFamily="{ThemeResource SymbolThemeFontFamily}"
                                        FontSize="6"
                                        Foreground="{ThemeResource SystemControlForegroundBaseHighBrush}"
                                        Glyph="&#xE0E2;"
                                        MirroredWhenRightToLeft="True" />
                                    <VisualStateManager.VisualStateGroups>
                                        <VisualStateGroup x:Name="CommonStates">
                                            <VisualState x:Name="Normal" />
                                            <VisualState x:Name="PointerOver">
                                                <Storyboard>
                                                    <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Root" Storyboard.TargetProperty="Background">
                                                        <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlHighlightBaseMediumLowBrush}" />
                                                    </ObjectAnimationUsingKeyFrames>
                                                    <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Arrow" Storyboard.TargetProperty="Foreground">
                                                        <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlHighlightAltBaseHighBrush}" />
                                                    </ObjectAnimationUsingKeyFrames>
                                                </Storyboard>
                                            </VisualState>
                                            <VisualState x:Name="Pressed">
                                                <Storyboard>
                                                    <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Root" Storyboard.TargetProperty="Background">
                                                        <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlHighlightBaseMediumBrush}" />
                                                    </ObjectAnimationUsingKeyFrames>
                                                    <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Arrow" Storyboard.TargetProperty="Foreground">
                                                        <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlHighlightAltAltHighBrush}" />
                                                    </ObjectAnimationUsingKeyFrames>
                                                </Storyboard>
                                            </VisualState>
                                            <VisualState x:Name="Disabled">
                                                <Storyboard>
                                                    <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Arrow" Storyboard.TargetProperty="Foreground">
                                                        <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlDisabledBaseHighBrush}" />
                                                    </ObjectAnimationUsingKeyFrames>
                                                </Storyboard>
                                            </VisualState>
                                        </VisualStateGroup>
                                    </VisualStateManager.VisualStateGroups>
                                </Grid>
                            </ControlTemplate>
                            <ControlTemplate x:Key="VerticalIncrementTemplate" TargetType="RepeatButton">
                                <Grid x:Name="Root">
                                    <FontIcon
                                        x:Name="Arrow"
                                        FontFamily="{ThemeResource SymbolThemeFontFamily}"
                                        FontSize="6"
                                        Foreground="{ThemeResource SystemControlForegroundBaseHighBrush}"
                                        Glyph="&#xE0E5;" />
                                    <VisualStateManager.VisualStateGroups>
                                        <VisualStateGroup x:Name="CommonStates">
                                            <VisualState x:Name="Normal" />
                                            <VisualState x:Name="PointerOver">
                                                <Storyboard>
                                                    <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Root" Storyboard.TargetProperty="Background">
                                                        <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlHighlightBaseMediumLowBrush}" />
                                                    </ObjectAnimationUsingKeyFrames>
                                                    <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Arrow" Storyboard.TargetProperty="Foreground">
                                                        <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlHighlightAltBaseHighBrush}" />
                                                    </ObjectAnimationUsingKeyFrames>
                                                </Storyboard>
                                            </VisualState>
                                            <VisualState x:Name="Pressed">
                                                <Storyboard>
                                                    <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Root" Storyboard.TargetProperty="Background">
                                                        <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlHighlightBaseMediumBrush}" />
                                                    </ObjectAnimationUsingKeyFrames>
                                                    <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Arrow" Storyboard.TargetProperty="Foreground">
                                                        <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlHighlightAltAltHighBrush}" />
                                                    </ObjectAnimationUsingKeyFrames>
                                                </Storyboard>
                                            </VisualState>
                                            <VisualState x:Name="Disabled">
                                                <Storyboard>
                                                    <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Arrow" Storyboard.TargetProperty="Foreground">
                                                        <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlDisabledBaseHighBrush}" />
                                                    </ObjectAnimationUsingKeyFrames>
                                                </Storyboard>
                                            </VisualState>
                                        </VisualStateGroup>
                                    </VisualStateManager.VisualStateGroups>
                                </Grid>
                            </ControlTemplate>
                            <ControlTemplate x:Key="VerticalDecrementTemplate" TargetType="RepeatButton">
                                <Grid x:Name="Root">
                                    <FontIcon
                                        x:Name="Arrow"
                                        FontFamily="{ThemeResource SymbolThemeFontFamily}"
                                        FontSize="6"
                                        Foreground="{ThemeResource SystemControlForegroundBaseHighBrush}"
                                        Glyph="&#xE0E4;" />
                                    <VisualStateManager.VisualStateGroups>
                                        <VisualStateGroup x:Name="CommonStates">
                                            <VisualState x:Name="Normal" />
                                            <VisualState x:Name="PointerOver">
                                                <Storyboard>
                                                    <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Root" Storyboard.TargetProperty="Background">
                                                        <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlHighlightBaseMediumLowBrush}" />
                                                    </ObjectAnimationUsingKeyFrames>
                                                    <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Arrow" Storyboard.TargetProperty="Foreground">
                                                        <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlHighlightAltBaseHighBrush}" />
                                                    </ObjectAnimationUsingKeyFrames>
                                                </Storyboard>
                                            </VisualState>
                                            <VisualState x:Name="Pressed">
                                                <Storyboard>
                                                    <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Root" Storyboard.TargetProperty="Background">
                                                        <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlHighlightBaseMediumBrush}" />
                                                    </ObjectAnimationUsingKeyFrames>
                                                    <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Arrow" Storyboard.TargetProperty="Foreground">
                                                        <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlHighlightAltAltHighBrush}" />
                                                    </ObjectAnimationUsingKeyFrames>
                                                </Storyboard>
                                            </VisualState>
                                            <VisualState x:Name="Disabled">
                                                <Storyboard>
                                                    <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Arrow" Storyboard.TargetProperty="Foreground">
                                                        <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlDisabledBaseHighBrush}" />
                                                    </ObjectAnimationUsingKeyFrames>
                                                </Storyboard>
                                            </VisualState>
                                        </VisualStateGroup>
                                    </VisualStateManager.VisualStateGroups>
                                </Grid>
                            </ControlTemplate>
                            <ControlTemplate x:Key="VerticalThumbTemplate" TargetType="Thumb">
                                <Rectangle
                                    x:Name="ThumbVisual"
                                    Fill="{ThemeResource SystemControlForegroundBaseLowBrush}"
                                    RadiusX="5"
                                    RadiusY="5">
                                    <VisualStateManager.VisualStateGroups>
                                        <VisualStateGroup x:Name="CommonStates">
                                            <VisualState x:Name="Normal" />
                                            <VisualState x:Name="PointerOver">
                                                <Storyboard>
                                                    <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ThumbVisual" Storyboard.TargetProperty="Fill">
                                                        <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlHighlightBaseMediumLowBrush}" />
                                                    </ObjectAnimationUsingKeyFrames>
                                                </Storyboard>
                                            </VisualState>
                                            <VisualState x:Name="Pressed">
                                                <Storyboard>
                                                    <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ThumbVisual" Storyboard.TargetProperty="Fill">
                                                        <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlHighlightBaseMediumBrush}" />
                                                    </ObjectAnimationUsingKeyFrames>
                                                </Storyboard>
                                            </VisualState>
                                            <VisualState x:Name="Disabled">
                                                <Storyboard>
                                                    <DoubleAnimation
                                                        Storyboard.TargetName="ThumbVisual"
                                                        Storyboard.TargetProperty="Opacity"
                                                        To="0"
                                                        Duration="0" />
                                                </Storyboard>
                                            </VisualState>
                                        </VisualStateGroup>
                                    </VisualStateManager.VisualStateGroups>
                                </Rectangle>
                            </ControlTemplate>
                            <ControlTemplate x:Key="HorizontalThumbTemplate" TargetType="Thumb">
                                <Rectangle
                                    x:Name="ThumbVisual"
                                    Fill="{ThemeResource SystemControlForegroundBaseLowBrush}"
                                    RadiusX="5"
                                    RadiusY="5">
                                    <VisualStateManager.VisualStateGroups>
                                        <VisualStateGroup x:Name="CommonStates">
                                            <VisualState x:Name="Normal" />
                                            <VisualState x:Name="PointerOver">
                                                <Storyboard>
                                                    <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ThumbVisual" Storyboard.TargetProperty="Fill">
                                                        <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlHighlightBaseMediumLowBrush}" />
                                                    </ObjectAnimationUsingKeyFrames>
                                                </Storyboard>
                                            </VisualState>
                                            <VisualState x:Name="Pressed">
                                                <Storyboard>
                                                    <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ThumbVisual" Storyboard.TargetProperty="Fill">
                                                        <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlHighlightBaseMediumBrush}" />
                                                    </ObjectAnimationUsingKeyFrames>
                                                </Storyboard>
                                            </VisualState>
                                            <VisualState x:Name="Disabled">
                                                <Storyboard>
                                                    <DoubleAnimation
                                                        Storyboard.TargetName="ThumbVisual"
                                                        Storyboard.TargetProperty="Opacity"
                                                        To="0"
                                                        Duration="0" />
                                                </Storyboard>
                                            </VisualState>
                                        </VisualStateGroup>
                                    </VisualStateManager.VisualStateGroups>
                                </Rectangle>
                            </ControlTemplate>
                        </Grid.Resources>
                        <Grid x:Name="HorizontalRoot" IsHitTestVisible="False">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition Width="*" />
                                <ColumnDefinition Width="Auto" />
                            </Grid.ColumnDefinitions>
                            <Rectangle
                                x:Name="HorizontalTrackRect"
                                Grid.ColumnSpan="5"
                                Height="7"
                                Margin="0"
                                Fill="Transparent"
                                RadiusX="5"
                                RadiusY="5"
                                Stroke="{ThemeResource SystemControlForegroundTransparentBrush}"
                                StrokeThickness="{ThemeResource ScrollBarTrackBorderThemeThickness}" />
                            <RepeatButton
                                x:Name="HorizontalSmallDecrease"
                                Grid.Column="0"
                                Width="12"
                                MinHeight="12"
                                Margin="0"
                                VerticalAlignment="Center"
                                Interval="50"
                                IsTabStop="False"
                                Opacity="0"
                                Template="{StaticResource HorizontalDecrementTemplate}" />
                            <RepeatButton
                                x:Name="HorizontalLargeDecrease"
                                Grid.Column="1"
                                Width="0"
                                HorizontalAlignment="Stretch"
                                VerticalAlignment="Stretch"
                                Interval="50"
                                IsTabStop="False"
                                Opacity="0"
                                Template="{StaticResource RepeatButtonTemplate}" />
                            <Thumb
                                x:Name="HorizontalThumb"
                                Grid.Column="2"
                                Height="7"
                                MinWidth="12"
                                AutomationProperties.AccessibilityView="Raw"
                                Background="{ThemeResource SystemControlForegroundChromeHighBrush}"
                                Template="{StaticResource HorizontalThumbTemplate}" />
                            <RepeatButton
                                x:Name="HorizontalLargeIncrease"
                                Grid.Column="3"
                                HorizontalAlignment="Stretch"
                                VerticalAlignment="Stretch"
                                Interval="50"
                                IsTabStop="False"
                                Opacity="0"
                                Template="{StaticResource RepeatButtonTemplate}" />
                            <RepeatButton
                                x:Name="HorizontalSmallIncrease"
                                Grid.Column="4"
                                Width="12"
                                MinHeight="12"
                                Margin="0"
                                VerticalAlignment="Center"
                                Interval="50"
                                IsTabStop="False"
                                Opacity="0"
                                Template="{StaticResource HorizontalIncrementTemplate}" />
                        </Grid>
                        <Grid x:Name="HorizontalPanningRoot" MinWidth="24">
                            <Border
                                x:Name="HorizontalPanningThumb"
                                Height="2"
                                MinWidth="32"
                                Margin="0,2,0,2"
                                HorizontalAlignment="Left"
                                VerticalAlignment="Bottom"
                                Background="{ThemeResource SystemControlForegroundChromeDisabledLowBrush}"
                                BorderThickness="0" />
                        </Grid>
                        <Grid x:Name="VerticalRoot" IsHitTestVisible="False">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="*" />
                                <RowDefinition Height="Auto" />
                            </Grid.RowDefinitions>
                            <Rectangle
                                x:Name="VerticalTrackRect"
                                Grid.RowSpan="5"
                                Height="7"
                                Margin="0"
                                RadiusX="5"
                                RadiusY="5"
                                Stroke="{ThemeResource SystemControlForegroundTransparentBrush}"
                                StrokeThickness="{ThemeResource ScrollBarTrackBorderThemeThickness}" />
                            <RepeatButton
                                x:Name="VerticalSmallDecrease"
                                Grid.Row="0"
                                Height="12"
                                MinWidth="12"
                                Margin="0"
                                HorizontalAlignment="Center"
                                Interval="50"
                                IsHitTestVisible="False"
                                IsTabStop="False"
                                Opacity="0"
                                Template="{StaticResource VerticalDecrementTemplate}" />
                            <RepeatButton
                                x:Name="VerticalLargeDecrease"
                                Grid.Row="1"
                                Height="0"
                                HorizontalAlignment="Stretch"
                                VerticalAlignment="Stretch"
                                Interval="50"
                                IsHitTestVisible="False"
                                IsTabStop="False"
                                Opacity="0"
                                Template="{StaticResource RepeatButtonTemplate}" />
                            <Thumb
                                x:Name="VerticalThumb"
                                Grid.Row="2"
                                Width="7"
                                MinHeight="12"
                                AutomationProperties.AccessibilityView="Raw"
                                Background="#FFEAEAEA"
                                Template="{StaticResource VerticalThumbTemplate}" />
                            <RepeatButton
                                x:Name="VerticalLargeIncrease"
                                Grid.Row="3"
                                HorizontalAlignment="Stretch"
                                VerticalAlignment="Stretch"
                                Interval="50"
                                IsHitTestVisible="False"
                                IsTabStop="False"
                                Opacity="0"
                                Template="{StaticResource RepeatButtonTemplate}" />
                            <RepeatButton
                                x:Name="VerticalSmallIncrease"
                                Grid.Row="4"
                                Height="12"
                                MinWidth="12"
                                Margin="0"
                                HorizontalAlignment="Center"
                                Interval="50"
                                IsHitTestVisible="False"
                                IsTabStop="False"
                                Opacity="0"
                                Template="{StaticResource VerticalIncrementTemplate}" />
                        </Grid>
                        <Grid x:Name="VerticalPanningRoot" MinHeight="24">
                            <Border
                                x:Name="VerticalPanningThumb"
                                Width="2"
                                MinHeight="32"
                                Margin="2,0,2,0"
                                HorizontalAlignment="Right"
                                VerticalAlignment="Top"
                                Background="#FFEAEAEA"
                                BorderThickness="0" />
                        </Grid>
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Normal" />
                                <VisualState x:Name="PointerOver" />
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <DoubleAnimation
                                            Storyboard.TargetName="Root"
                                            Storyboard.TargetProperty="Opacity"
                                            To="0.5"
                                            Duration="0" />
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="HorizontalTrackRect" Storyboard.TargetProperty="Stroke">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlDisabledTransparentBrush}" />
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="VerticalTrackRect" Storyboard.TargetProperty="Stroke">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlDisabledTransparentBrush}" />
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="HorizontalPanningThumb" Storyboard.TargetProperty="Background">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlDisabledChromeHighBrush}" />
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="ScrollingIndicatorStates">
                                <VisualState x:Name="TouchIndicator">
                                    <Storyboard>
                                        <FadeInThemeAnimation TargetName="HorizontalPanningRoot" />
                                        <FadeInThemeAnimation TargetName="VerticalPanningRoot" />
                                        <FadeOutThemeAnimation TargetName="HorizontalRoot" />
                                        <FadeOutThemeAnimation TargetName="VerticalRoot" />
                                        <ObjectAnimationUsingKeyFrames
                                            Storyboard.TargetName="HorizontalRoot"
                                            Storyboard.TargetProperty="Visibility"
                                            Duration="0">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Collapsed</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames
                                            Storyboard.TargetName="VerticalRoot"
                                            Storyboard.TargetProperty="Visibility"
                                            Duration="0">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Collapsed</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="MouseIndicator">
                                    <Storyboard>
                                        <FadeInThemeAnimation TargetName="HorizontalRoot" />
                                        <FadeInThemeAnimation TargetName="VerticalRoot" />
                                        <FadeOutThemeAnimation TargetName="HorizontalPanningRoot" />
                                        <ObjectAnimationUsingKeyFrames
                                            Storyboard.TargetName="HorizontalPanningRoot"
                                            Storyboard.TargetProperty="Visibility"
                                            Duration="0">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Collapsed</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                        <FadeOutThemeAnimation TargetName="VerticalPanningRoot" />
                                        <ObjectAnimationUsingKeyFrames
                                            Storyboard.TargetName="VerticalPanningRoot"
                                            Storyboard.TargetProperty="Visibility"
                                            Duration="0">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Collapsed</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="HorizontalRoot" Storyboard.TargetProperty="IsHitTestVisible">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <x:Boolean>True</x:Boolean>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="VerticalRoot" Storyboard.TargetProperty="IsHitTestVisible">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <x:Boolean>True</x:Boolean>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="NoIndicator">
                                    <Storyboard>
                                        <FadeOutThemeAnimation BeginTime="0" TargetName="HorizontalPanningRoot" />
                                        <FadeOutThemeAnimation BeginTime="0" TargetName="VerticalPanningRoot" />
                                        <FadeOutThemeAnimation BeginTime="0" TargetName="HorizontalRoot" />
                                        <FadeOutThemeAnimation BeginTime="0" TargetName="VerticalRoot" />
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

 

 这段神秘代码可以应用在ScrollViewer, ListView, TextBox(多行),GridView等等。

UWP 滚动条私人定制

标签:等等   vertica   tabs   row   listview   disabled   type   min   image   

原文地址:https://www.cnblogs.com/hupo376787/p/8297994.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!