O'Reilly logo

XAML Unleashed by Adam Nathan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required