-
Notifications
You must be signed in to change notification settings - Fork 5
CommentOutElement Xaml Mapping Action
ldfallas edited this page Aug 31, 2015
·
3 revisions
Comments out the current XAML element.
No properties
We want to comment out Setter instances that have references to a Windows Phone static resource.
For example:
--Windows Phone 8 Silverlight--
...
<Style TargetType="TextBlock">
<Setter Property="Foreground" Value="{StaticResource PhoneAccentBrush}"/>
</Style>
...The mapping definition 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="Setter" ElementNamespace="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<xmap:XamlElementMapper.Maps>
<xmap:XamlMap Kind="Element">
<xmap:XamlMap.Action>
<xmap:CommentOutElement>
<xmap:CommentOutElement.Condition>
<xmap:ElementContainsAttribute PropertyLocalName="Value" PropertyValueRegex="^.StaticResource Phone.*" />
</xmap:CommentOutElement.Condition>
</xmap:CommentOutElement>
</xmap:XamlMap.Action>
</xmap:XamlMap>
</xmap:XamlElementMapper.Maps>
</xmap:XamlElementMapper>
</MapUnit.Elements>
</MapUnit>
The converted code looks like this:
<Style TargetType="TextBlock">
<!--<Setter Property="Foreground" Value="{StaticResource PhoneAccentBrush}" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" />-->
</Style>- This XAML action only applies to elements. If this action is applied to a property no action will be performed
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