UriMapping.MappedUri Property

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Gets or sets the uniform resource identifier (URI) that is navigated to instead of the originally requested URI.

Namespace:  System.Windows.Navigation
Assembly:  System.Windows.Controls.Navigation (in System.Windows.Controls.Navigation.dll)

Syntax

'Declaration
Public Property MappedUri As Uri
public Uri MappedUri { get; set; }
<sdk:UriMapping MappedUri="uriString"/>

Property Value

Type: System.Uri
The URI that the requested URI is converted to.

Remarks

When a requested URI matches the pattern you specify in the Uri property, the Silverlight framework navigates to the URI you specify in the MappedUri property. Typically, you set the Uri property to a user-friendly value, such as Home, and you set the MappedUri property to the actual file to use for the request, such as /Views/HomePage.xaml.

Examples

The following example shows an instance of UriMapper that is defined within a frame named ContentFrame. The element contains a collection of UriMapping objects.

<sdk:Frame 
       x:Name="ContentFrame" 
       Style="{StaticResource ContentFrameStyle}" 
       Source="/Home" 
       Navigated="ContentFrame_Navigated" 
       NavigationFailed="ContentFrame_NavigationFailed">
    <sdk:Frame.UriMapper>
        <sdk:UriMapper>
            <sdk:UriMapping 
                Uri="/ProductDetail/{productid}" 
                MappedUri="/Views/ProductDetail.xaml?ProductId={productid}"/>
            <sdk:UriMapping 
                Uri="/Reports/{type}/{selection}" 
                MappedUri="/Views/ReportsPage.xaml?type={type}&amp;selection={selection}"/>
            <sdk:UriMapping 
                Uri="/{pageName}" 
                MappedUri="/Views/{pageName}.xaml"/>
        </sdk:UriMapper>
    </sdk:Frame.UriMapper>
</sdk:Frame>

Version Information

Silverlight

Supported in: 5, 4, 3

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.