gpt4 book ai didi

colors - 更改滚动条颜色 LongListSelector - WP8

转载 作者:行者123 更新时间:2023-12-02 03:01:50 26 4
gpt4 key购买 nike

有谁知道如何更改 LongListSelector 的滚动条的颜色。我尝试更改 ControlTemplate 上的前景,但没有成功。

最佳答案

LongListSelectors 模板中 ScrollBar 的可见部分实际上是背景。

因此,将滚动条设置为 Fuschia。

在模板中设置滚动条的背景,如下所示:

<Style x:Key="LongListSelectorStyle1" TargetType="phone:LongListSelector">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Foreground" Value="{StaticResource PhoneForegroundBrush}"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="phone:LongListSelector">
<Grid Background="{TemplateBinding Background}" d:DesignWidth="480" d:DesignHeight="800">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="ScrollStates">
<VisualStateGroup.Transitions>
<VisualTransition GeneratedDuration="00:00:00.5"/>
</VisualStateGroup.Transitions>
<VisualState x:Name="Scrolling">
<Storyboard>
<DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="VerticalScrollBar"/>
</Storyboard>
</VisualState>
<VisualState x:Name="NotScrolling"/>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Grid Margin="{TemplateBinding Padding}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="auto"/>
</Grid.ColumnDefinitions>
<ViewportControl x:Name="ViewportControl" HorizontalContentAlignment="Stretch" VerticalAlignment="Top" />
<ScrollBar x:Name="VerticalScrollBar" Background="Fuchsia" Grid.Column="1" Margin="4,0,4,0" Opacity="0" Orientation="Vertical"/>
</Grid>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>

然后使用:

<phone:LongListSelector Style="{StaticResource LongListSelectorStyle1" />

关于colors - 更改滚动条颜色 LongListSelector - WP8,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18853281/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com