Ivan I
Ivan I

Reputation: 9990

Pivot WP 8.1 VisualStateManager for selected items doesn't work?

Why this doesn't work on Windows Phone 8.1 RT (no effect on header opacity):

        <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>

Upvotes: 0

Views: 395

Answers (2)

Ivan I
Ivan I

Reputation: 9990

It seems that this is the bug in WP, so I skipped whole VisualStateManager and bound Opacity directly from ViewModel to subheader.

Upvotes: 0

Rob Caplan - MSFT
Rob Caplan - MSFT

Reputation: 21919

This is a known issue with customised Pivot Header in Windows Phone Runtime. The Silverlight 8.1 Pivot works correctly.

I'm not aware of any workarounds that would give the control you are looking for. You can override the Pivot's theme colours app-wide in the app.xaml's resources. The presenter for the header is encapsulated in the PivotHeaderPanel and so their full appearance cannot be modified in the base Pivot style outside of the HeaderTemplate you're already using (and which doesn't dim the non-selected pages when customised, as you're seeing).

--Rob

Upvotes: 1

Related Questions