-
Notifications
You must be signed in to change notification settings - Fork 5
Panorama to Hub considerations
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:
- Define a field for the control and assign it using the control's Loaded event (described here: http://stackoverflow.com/questions/22659179/how-to-access-controls-within-hubsections-in-win-8-1-store-app-searching-in-vis )
- Avoid using the controls directly on code behind and use an MVVM approach by binding the required properties to a view model.
- Animation targets still require named elements
More information here
- https://social.msdn.microsoft.com/Forums/en-US/a963577d-c567-45c3-b684-7325cc2c8c69/access-frame-control-contained-within-datatemplate-of-hubsection?forum=w81prevwCsharp
- http://stackoverflow.com/questions/22126659/how-to-access-any-control-inside-hubsection-datatemplate-in-windows-8-1-store
- http://stackoverflow.com/questions/22659179/how-to-access-controls-within-hubsections-in-win-8-1-store-app-searching-in-vis
Contact us for more information
Overview
Writing mappings
Code Mapping Actions
- ActionSequence
- AddHelper
- AddNamespaceImport
- AddPreStatementFromTemplate
- CommentOut
- Conditional
- Keep Code Mapping Action
- MarkAsNotMapped
- RedirectCall
- RedirectCallToInnerMember
- RedirectIndexer
- RedirectProperty
- RemoveCurrentStatement
- RemoveParameter
- ReplaceClassUsage
- ReplaceMethodBodyWithTemplate
- ReplaceParameterDeclarationType
- ReplaceParameterMember
- ReplaceParameterValue
- ReplaceWithMethodCall
- ReplaceWithProperty
- ReplaceWithTemplate
Code Mapping Conditions
- AllConditionsApply
- ArgumentCount
- AssignName
- AssignNameToArgumentRange
- IsExpressionOfType
- IsStringLiteralMatchingRegex
- WithArgument
- WithAssignment
- WithAssignmentLeftSide
- WithAssignmentRightSide
- WithCalledMemberOwner
- WithCalledMethodExpression
- WithConstructorCall
- WithLambdaExpressionBody
- WithLambdaExpressionParameter
- WithLeftSideOfDottedAccess
- WithMemberInitValue
- WithMethodCall
XAML mapping actions
- ActionSequence
- AddStatementToConstructorFromTemplate
- BindPropertyValueElement Xaml mapping action
- ChangeEventHandlerEventArgsType
- CommentOutElement
- CommentOutProperty
- MarkAsNotMapped
- MoveValueToContentProperty
- RemoveNamespaceDeclaration
- RenameElement
- RenameProperty
- ReplaceAttributeValue
- ReplaceEventHandlerBodyWithTemplate
- ReplaceEventHandlerParameterMember
- ReplaceNamespaceDeclaration
- ReplacePropertyValueWithParentResource
- ReplaceStaticResourceWithThemeResource
- SetPropertyValueToComplexElement
- SetPropertyValueToSimpleValue
- WrapContent
XAML mapping conditions
Misc