[英]change the color of each pivot item in windows phone 8
I want to assign the different colors to each pivot item of pivot control of windows 8. 我想为Windows 8的数据透视控件的每个数据透视表项分配不同的颜色。
Red color for all, green for assigned. 全部为红色,已分配为绿色。 How do i achieve it??
我该如何实现?
<Grid x:Name="LayoutRoot" Background="#FF0B345A">
<!--Pivot Control-->
<phone:Pivot Title="MY TASKS">
<!--Pivot item one-->
<phone:PivotItem Header="all">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="auto"></RowDefinition>
<RowDefinition Height="auto"></RowDefinition>
<RowDefinition Height="auto"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions>
<StackPanel Margin="0,25,0,0" Grid.Row="0">
<TextBlock Text="Due Today 12:00PM" Foreground="#FF4472A2"></TextBlock>
</StackPanel>
<StackPanel Margin="0,25,0,0" Grid.Row="1">
<TextBlock Text="Sales On-Boarding" Foreground="#FFB7BEC6"></TextBlock>
<TextBlock Text="Due 9/25/13" Foreground="#FF4472A2"></TextBlock>
</StackPanel>
</Grid>
</phone:PivotItem>
<!--Pivot item two-->
<phone:PivotItem Header="assigned">
<Grid/>
</phone:PivotItem>
<!--Pivot item three-->
<phone:PivotItem Header="overdue">
<Grid/>
</phone:PivotItem>
</phone:Pivot>
</Grid>
Try this 尝试这个
<Grid x:Name="LayoutRoot" Background="#FF0B345A">
<!--Pivot Control-->
<phone:Pivot Title="MY TASKS">
<!--Pivot item one-->
<phone:PivotItem>
<controls:PivotItem.Header>
<Grid Background="Red">
<TextBlock Name="allRecords" Text="all" />
</Grid>
</controls:PivotItem.Header>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="auto"></RowDefinition>
<RowDefinition Height="auto"></RowDefinition>
<RowDefinition Height="auto"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions>
<StackPanel Margin="0,25,0,0" Grid.Row="0">
<TextBlock Text="Due Today 12:00PM" Foreground="#FF4472A2"></TextBlock>
</StackPanel>
<StackPanel Margin="0,25,0,0" Grid.Row="1">
<TextBlock Text="Sales On-Boarding" Foreground="#FFB7BEC6"></TextBlock>
<TextBlock Text="Due 9/25/13" Foreground="#FF4472A2"></TextBlock>
</StackPanel>
</Grid>
</phone:PivotItem>
<!--Pivot item two-->
<phone:PivotItem>
<controls:PivotItem.Header>
<Grid Background="Red">
<TextBlock Name="assignedRecords" Text="assigned" />
</Grid>
</controls:PivotItem.Header>
<Grid/>
</phone:PivotItem>
<!--Pivot item three-->
<phone:PivotItem>
<controls:PivotItem.Header>
<Grid Background="Red">
<TextBlock Name="overdueRecords" Text="overdue" />
</Grid>
</controls:PivotItem.Header>
<Grid/>
</phone:PivotItem>
</phone:Pivot>
</Grid>
只需将属性Background="your preferred color"
到每个phone:PivotItem
元素。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.