Skip to content

Panorama to Hub considerations

ldfallas edited this page Oct 7, 2015 · 1 revision

The Panorama control ( https://msdn.microsoft.com/en-us/library/windows/apps/ff941104.aspx ) acts as a container control. For example:

<controls:Panorama>
...
    <controls:PanoramaItem>
          <TextBlock x:Name="myText" />
    </controls:PanoramaItem>
...
</control:Panorama>

The recommended control (https://msdn.microsoft.com/en-us/library/mt149137.aspx ) for converting the Panorama control to UWP is the Hub control (https://msdn.microsoft.com/en-us/library/windows.ui.xaml.controls.hub.aspx ). The current conversion of this control is the following:

<Hub>
...
       <HubSection>
          <DataTemplate>
            <TextBlock x:Name="myText" />
          </DataTemplate>
        </HubSection>
...
</Hub>

However this control behaves differently from Panorama in the way it treats the child elements of HubSections. HubSections uses a DataTemplate which doesn't allow to use names x:Name to make child element accessible to code behind or animation targets.

There are several ways to solve this problem:

More information here

Overview

Writing mappings

Code Mapping Actions

Code Mapping Conditions

XAML mapping actions

XAML mapping conditions

Misc

Clone this wiki locally
You can’t perform that action at this time.