![](/img/trans.png)
[英]Unable to change the foreground color of Pivot different from Pivot Item in windows phone 8
[英]change the color of each pivot item in windows phone 8
我想為Windows 8的數據透視控件的每個數據透視表項分配不同的顏色。
全部為紅色,已分配為綠色。 我該如何實現?
<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>
嘗試這個
<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.