Skip to content

SetPropertyValueToSimpleValue Xaml Mapping Action

ldfallas edited this page Aug 31, 2015 · 3 revisions

Description

Sets the value of a string property on the current element.

Properties

​Property ​Usage ​Description
NewPropertyValue Required The string value to set.
AttributeToChangeName Optional The name of the attribute to set the value to
AttributeToChangeNamespace Optional The namespace of the attribute to set the value to

Example

Say that we want to set the Background property to Transparent to grids having Page as its parent. We can write the following mapping:

<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="Grid" ElementNamespace="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
            <xmap:XamlElementMapper.Maps>
                ...
                <xmap:XamlMap Kind="Element">
                    <xmap:XamlMap.Action>
                        <xmap:SetPropertyValueToSimpleValue  AttributeToChangeName="Background" NewPropertyValue="{ThemeResource ApplicationPageBackgroundThemeBrush}">
                            <xmap:SetPropertyValueToSimpleValue.Condition>
                                <xmap:ElementParent ParentElementName="Page" ParentElementNamespace="http://schemas.microsoft.com/winfx/2006/xaml/presentation" />
                            </xmap:SetPropertyValueToSimpleValue.Condition>
                        </xmap:SetPropertyValueToSimpleValue>
                    </xmap:XamlMap.Action>
                </xmap:XamlMap>
            </xmap:XamlElementMapper.Maps>
            ...
        </xmap:XamlElementMapper>
    </MapUnit.Elements>
</MapUnit>

Notes

  • Variables bound using the [BindPropertyValueElement Xaml Mapping Action](BindPropertyValueElement Xaml Mapping Action) could also be used as the value of NewPropertyValue

Overview

Writing mappings

Code Mapping Actions

Code Mapping Conditions

XAML mapping actions

XAML mapping conditions

Misc

Clone this wiki locally