I need to change the contents of an AppBar when a user changes the view in a Hub control.
The way I did it while using a Pivot control is listening to the SelectionChanged event and responding to the SelectIndex value.
The hub, however, only has a SectionsInViewChanged event, which returns a collection of multiple sections. Usually the one user is interacting with and then the adjacent, barely-visible section.
So my question is, how can I tell which Section is the one that is currently being prominently displayed to the user (so I can change the AppBar icons accordingly)?
In Hub control, We can listen to the
SectionsInViewChanged
event. We can get the HubSection which is displayed in screen by this:hubDemo
is the name of my Hub control. And we can setTag
property for each HubSection. For example:So we can change AppBar content by tag: