简体   繁体   中英

WP7 PivotItem doesn't accept foreground if Pivot has set foreground

Having the xaml as below:

<controls:Pivot Title="TEST" Foreground="#FF0000FF">
        <controls:PivotItem Foreground="#FF00FF00">

the second foreground color is not used for title (only for content)... The goal is to have Pivot.Title with different color than the PivotItem.Title... this works for Panorama and PanoroamaItem - is this a bug in wp7 control?

The way in which the styles and templates are defined for the Pivot does not allow you to specify the foreground color for the PivotItem in this way, however you can apply a different HeaderTemplate as follows:

<controls:Pivot Title="TEST" Foreground="#FF0000FF">
            <controls:Pivot.HeaderTemplate>
                <DataTemplate>
                    <TextBlock Foreground="#FF00FF00" Text="{Binding}" />
                </DataTemplate>
            </controls:Pivot.HeaderTemplate>
            <!--Pivot item one-->
            <controls:PivotItem Header="first">

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM