-
Notifications
You must be signed in to change notification settings - Fork 5
CommentOutProperty Xaml Mapping Action
ldfallas edited this page Aug 31, 2015
·
3 revisions
Comments out the current property.
*No properties *
Say that we want to comment out the TextBlock.FontFamily
property when the value is a reference to the PhoneFontFamilySemiBold
static resource.
For example:
<TextBlock Text="page name" FontFamily="{StaticResource PhoneFontFamilySemiBold}"/>
The mapping could look 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="TextBlock" ElementNamespace="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<xmap:XamlElementMapper.Maps>
...
<xmap:XamlMap Kind="Property" PropertyName="FontFamily" >
<xmap:XamlMap.Action>
<xmap:ActionSequence>
<xmap:RemoveAttribute>
<xmap:RemoveAttribute.Condition>
<xmap:PropertyUsesStaticResource PropertyName="FontFamily" StaticResourceName="PhoneFontFamilyNormal" />
</xmap:RemoveAttribute.Condition>
</xmap:RemoveAttribute>
<xmap:CommentOutProperty>
<xmap:CommentOutProperty.Condition>
<xmap:PropertyUsesStaticResource
PropertyName="FontFamily"
StaticResourceName="PhoneFontFamilySemiBold" />
</xmap:CommentOutProperty.Condition>
</xmap:CommentOutProperty>
</xmap:ActionSequence>
</xmap:XamlMap.Action>
</xmap:XamlMap>
...
</xmap:XamlElementMapper.Maps>
</xmap:XamlElementMapper>
</MapUnit.Elements>
</MapUnit>
The result of applying this mapping is the following:
--Windows UWP XAML--
<TextBlock Text="page name">
<!--FontFamily="{StaticResource PhoneFontFamilySemiBold}"-->
</TextBlock>
- This action will comment out properties specified using the
attribute
andelement
syntax.
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