如何为 Pivot Items 设置两个不同的背景,例如“All”为蓝色,“NotAll”为红色。
<Pivot x:Name="Pivot" HorizontalContentAlignment="Center"">
<PivotItem Header="All" x:Name="All">
<ListView
ItemsSource="{Binding Source={StaticResource AllList}}"
SelectionMode="None">
</ListView>
</PivotItem>
<PivotItem x:Name="NotAll" Header="Not All">
<ListView
ItemsSource="{Binding Source={StaticResource NotAllList}}"
SelectionMode="None">
</ListView>
</PivotItem>
</Pivot>
如果您只想设置整个枢轴项的背景颜色,您可以设置其Background
属性:
<Pivot x:Name="Pivot" HorizontalContentAlignment="Center">
<PivotItem Background="Blue" ...>
...
</PivotItem>
<PivotItem Background="Red" ...>
...
</PivotItem>
</Pivot>
或者,如果您想更改标题文本的颜色,您可以使用复杂的属性语法并将标题设置为自定义控件:
<PivotItem x:Name="NotAll">
<PivotItem.Header>
<TextBlock Foreground="Red" Text="Not all" />
</PivotItem.Header>
...
</PivotItem>
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句