-
Notifications
You must be signed in to change notification settings - Fork 5
MoveValueToContentProperty Xaml Mapping Action
ldfallas edited this page Aug 31, 2015
·
3 revisions
<xmap:MoveValueToContentProperty/>
Moves the value of the current property to the content property of the current element.
Property | Usage | Description |
---|---|---|
AtTheEnd | Optional | True or False value that determines if the the element is added at the end |
For this example we want to move the value of two properties to the content property of the target element.
We're going to take the Header
and Items
property of the ExpanderView control and move them to the content property wrapped in a Stack panel.
The mapping looks like this:
<MapUnit xmlns='clr-namespace:Mobilize.Mappers.Extensibility.Core;assembly=Mobilize.ExtensibleMappers'
xmlns:xmap='clr-namespace:Mobilize.XamlMappers;assembly=Mobilize.XamlMapper'
xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml' >
<MapUnit.Elements>
<xmap:XamlElementMapper ElementName="ExpanderView" ElementNamespace="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit">
<xmap:XamlElementMapper.Maps>
<xmap:XamlMap Kind="Property" PropertyName="Header" >
<xmap:XamlMap.Action>
<xmap:ActionSequence>
<xmap:WrapContent WrappingElementName="StackPanel"
WrappingElementNamespace="http://schemas.microsoft.com/winfx/2006/xaml/presentation" />
<xmap:MoveValueToContentProperty />
</xmap:ActionSequence>
</xmap:XamlMap.Action>
</xmap:XamlMap>
<xmap:XamlMap Kind="Property" PropertyName="Items" >
<xmap:XamlMap.Action>
<xmap:ActionSequence>
<xmap:WrapContent WrappingElementName="StackPanel"
WrappingElementNamespace="http://schemas.microsoft.com/winfx/2006/xaml/presentation" />
<xmap:MoveValueToContentProperty AtTheEnd="true" />
</xmap:ActionSequence>
</xmap:XamlMap.Action>
</xmap:XamlMap>
<xmap:XamlMap Kind="Property" PropertyName="IsExpanded" >
<xmap:XamlMap.Action>
<xmap:MarkAsNotMapped ElementName="ExpanderView"/>
</xmap:XamlMap.Action>
</xmap:XamlMap>
<xmap:XamlMap Kind="Element">
<xmap:XamlMap.Action>
<xmap:RenameElement NewName="StackPanel" NewNamespace="http://schemas.microsoft.com/winfx/2006/xaml/presentation" />
</xmap:XamlMap.Action>
</xmap:XamlMap>
</xmap:XamlElementMapper.Maps>
</xmap:XamlElementMapper>
</MapUnit.Elements>
</MapUnit>
Given the following code:
-- Windows Phone 8 Silverlight --
<tk:ExpanderView>
<tk:ExpanderView.Header>
<TextBlock>Hello</TextBlock>
</tk:ExpanderView.Header>
<tk:ExpanderView.Items>
<TextBlock>World</TextBlock>
</tk:ExpanderView.Items>
</tk:ExpanderView>
We get the following converted code:
--Windows UWP--
<StackPanel>
<StackPanel>
<TextBlock>Hello</TextBlock>
</StackPanel>
<StackPanel>
<TextBlock>World</TextBlock>
</StackPanel>
</StackPanel>
- This mapping action can only be used in a
XamlMap
of kindProperty
.
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