Xaml 选定项目的Pivot WP 8.1 VisualStateManager不';不行?
为什么这在Windows Phone 8.1 RT上不起作用(对标题不透明度没有影响):Xaml 选定项目的Pivot WP 8.1 VisualStateManager不';不行?,xaml,windows-phone-8.1,Xaml,Windows Phone 8.1,为什么这在Windows Phone 8.1 RT上不起作用(对标题不透明度没有影响): 这是Windows Phone运行时自定义Pivot标头的已知问题。Silverlight 8.1 Pivot工作正常 我不知道有什么变通办法可以让你获得你想要的控制权。您可以在app.xaml的资源中覆盖Pivot的主题颜色应用程序范围。标题的演示者封装在PivotHeaderPanel中,因此不能在您已经使用的HeaderTemplate之外的基础Pivot样式中修改其完整外观(如您所见,定制时不会使未
这是Windows Phone运行时自定义Pivot标头的已知问题。Silverlight 8.1 Pivot工作正常 我不知道有什么变通办法可以让你获得你想要的控制权。您可以在app.xaml的资源中覆盖Pivot的主题颜色应用程序范围。标题的演示者封装在PivotHeaderPanel中,因此不能在您已经使用的HeaderTemplate之外的基础Pivot样式中修改其完整外观(如您所见,定制时不会使未选择的页面变暗)
--Rob这似乎是WP中的错误,因此我跳过了整个VisualStateManager,并将不透明度直接从ViewModel绑定到subheader。将状态更改放在样式控制模板中,而不是标题数据模板中,它会起作用。感谢您的想法,但当我这样做的时候,我得到了预期的数据模板…我将不得不在稍后一段时间拉出模板以确定是否存在,但应该有一个ContentPresenter或HeaderPanel,或者其中的其他内容,您将以“subheader”以外的目标为目标,因此确保您设置了正确的目标。谢谢,我知道一个解决方法,那就是在viewmodel中设置不透明度并在那里切换。这不是太难看,如果没有其他答案,那么我想我会把它作为答案发布。。。
<Pivot ItemsSource="{Binding PivotDefinition}">
<Pivot.HeaderTemplate>
<DataTemplate>
<Grid>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="SelectionStates">
<VisualState x:Name="Selected">
<Storyboard>
<DoubleAnimation Duration="0" Storyboard.TargetName="subheader" Storyboard.TargetProperty="Opacity" To="1"/>
</Storyboard>
</VisualState>
<VisualState x:Name="Unselected">
<Storyboard>
<DoubleAnimation Duration="0" Storyboard.TargetName="subheader" Storyboard.TargetProperty="Opacity" To="0.4"/>
</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<TextBlock x:Name="subheader" Text="{Binding Title}"/>
</Grid>
</DataTemplate>
</Pivot.HeaderTemplate>
</Pivot>