1

我尝试为 创建全局样式PivotHeaderItem,但没有得到应用。我知道我可以Pivot为.HeaderTemplatePivotHeaderItem

在 App.xaml 中,我有以下代码段:

<Application.Resources>
    <ResourceDictionary>
        <Style TargetType="Primitives:PivotHeaderItem">
            <Setter Property="Background" Value="Transparent"/>
            <Setter Property="Padding" Value="21,0,1,0"/>
            <Setter Property="Margin" Value="0"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="Primitives:PivotHeaderItem">
                        <Grid>
                            <VisualStateManager.VisualStateGroups>
                                <VisualStateGroup x:Name="SelectionStates">
                                    <VisualState x:Name="Unselected"/>
                                    <VisualState x:Name="Selected">
                                        <Storyboard>
                                            <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="contentPresenter"/>
                                        </Storyboard>
                                    </VisualState>
                                </VisualStateGroup>
                            </VisualStateManager.VisualStateGroups>
                            <TextBlock Foreground="Green" Text="{Binding}" />
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

    </ResourceDictionary>
</Application.Resources>
4

0 回答 0