Jumping to a HubSection
Hub
exposes a handy SectionHeaders
property that is a collection of Header
objects from each HubSection
. In this section, we leverage the same property and method to provide a much simpler shortcut mechanism. This works well if each HubSection
’s Header
is a string rather than a UIElement
. If you mark our example Hub
with Name="hub"
, you can use the following data binding trick (see Chapter 19, “Animation”) to fill a ComboBox
with the section names:
<ComboBox Header="Jump to a Section" SelectionChanged="ComboBox_SelectionChanged" ItemsSource="{Binding SectionHeaders , ElementName=hub}"/>
The SelectionChanged
handler can use the ScrollToSection
method to make selecting a header jump ...
Get XAML Unleashed now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.