2
我想更改Pivot項目的標題顏色以匹配主題顏色。但是我也想在某些條件下將其更改回默認顏色(黑白或取決於設置中的背景設置)。我該怎麼做。不勝感激!WP:如何將Pivot標題的前景色更改爲主題顏色或默認顏色
<phone:PivotItem x:Name="pivot_vip">
<phone:PivotItem.Header>
<TextBlock Text="{Binding Path=LocalizedResources.Artists, Source={StaticResource LocalizedStrings}}"/>
</phone:PivotItem.Header>
private void View_selection_changed(
...
PivotItem currentItem = e.AddedItems[0] as PivotItem;
if (currentItem != null)
{
if (current_view == HanlderType.EVIPHandler)
{
(currentItem.Header as TextBlock).Foreground = ??? //Theme color
}
else
{
(currentItem.Header as TextBlock).Foreground = **???** //whatever default
}
}
感謝您快速回答!我改變了一些問題。如何將顏色更改爲默認標題?例如,默認爲黑色或白色(取決於設置/主題/背景[黑白]中的設置) – thsieh
根據當前主題,我的答案會爲您提供默認標題顏色。 –