Search code examples
template10

UWP Semantic Zoom, ListView, VisualState


<SemanticZoom x:Name="Zoom" > <SemanticZoom.ZoomedInView> <ListView Name="HotelInList" IsItemClickEnabled="False" Style="{StaticResource HotelListViewStyle}" ItemContainerStyle="{StaticResource HotelListItemContainerStyle}" ItemsSource="{Binding Source={StaticResource HotelViewSource}}" ItemTemplate="{StaticResource HotelListItemTemplate}" SelectedItem="{Binding Selected, Mode=TwoWay}" > <Interactivity:Interaction.Behaviors> <Core:EventTriggerBehavior EventName="ItemClick"> <Core:GoToStateAction StateName="DetailVisualState" /> </Core:EventTriggerBehavior> </Interactivity:Interaction.Behaviors> <ListView.GroupStyle>

The interactivity snippet above doesn't work. It will complain about how HotelInList doesn't contain a visual state named DetailVisualState, which is left out for brevity for now, but it is a visualstate above part of the rootlayout grid

Would nesting inside the SemanticZoom block the EventTriggerBehavior?


Solution

  • <Interactivity:Interaction.Behaviors> <Core:EventTriggerBehavior EventName="ItemClick"> <Core:GoToStateAction StateName="DetailVisualState" TargetObject="{Binding ElementName=ThisPage}" /> </Core:EventTriggerBehavior> </Interactivity:Interaction.Behaviors>

    Where ThisPage is the x:Name of the actual page, which forces the interaction to look down the resource tree and find from the the available resources the visualstate you requested.