Skip to content

WrapContent Xaml Mapping Action

ldfallas edited this page Aug 17, 2015 · 2 revisions

Description

Generates a wrapper element for the content of the current element.

Properties

​Property ​Usage ​Description
WrappingElementName Required The name of the wrapper element to be generated
WrappingElementNamespace Required The xml/xaml namespace of the element being generated

Example

Say that we will convert from PanoramaItem in WP8 to HubSection in UWP.

For example this Windows Phone 8 Silverlight code:

<phone:PanoramaItem>
       <TextBlock>Hello!</TextBlock>
</phone:PanoramaItem>

We want to convert the previous code the following UWP code:

<HubSection>
   <DataTemplate>
     <TextBlock>Hello!</TextBlock>
   </DataTemplate>
</HubSection>

We can use the WrapContent action as follows:

<xmap:XamlElementMapper ElementName="PanoramaItem"
                        ElementNamespace="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone">
    <xmap:XamlElementMapper.Maps>
        <xmap:XamlMap Kind="Element">
            <xmap:XamlMap.Action>
                <xmap:RenameElement NewName="HubSection" NewNamespace="http://schemas.microsoft.com/winfx/2006/xaml/presentation" />
            </xmap:XamlMap.Action>
        </xmap:XamlMap>
        <xmap:XamlMap Kind="Element">
            <xmap:XamlMap.Action>

                <xmap:WrapContent
                        WrappingElementName="DataTemplate"
                        WrappingElementNamespace="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                   />

            </xmap:XamlMap.Action>
        </xmap:XamlMap>
    </xmap:XamlElementMapper.Maps>
    ...
</xmap:XamlElementMapper>

Notes

  • The wrapper will not wrap the properties that use element style setters

Overview

Writing mappings

Code Mapping Actions

Code Mapping Conditions

XAML mapping actions

XAML mapping conditions

Misc

Clone this wiki locally