Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

UriMapper Class

Converts a uniform resource identifier (URI) into a new URI based on the rules of a matching object specified in a collection of mapping objects.

Namespace:  System.Windows.Navigation
Assembly:  System.Windows.Controls.Navigation (in System.Windows.Controls.Navigation.dll)
[ContentPropertyAttribute("UriMappings")]
public sealed class UriMapper : UriMapperBase
<sdk:UriMapper>
  oneOrMoreUriMappings
</sdk:UriMapper> 

XAML Values

oneOrMoreUriMappings

One or more UriMapping object elements.

The UriMapper type exposes the following members.

  NameDescription
Public methodUriMapperInitializes a new instance of the UriMapper class.
Top
  NameDescription
Public propertyUriMappingsGets a collection of objects that are used to convert a uniform resource identifier (URI) into a new URI.
Top
  NameDescription
Public methodEquals(Object)Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection. (Inherited from Object.)
Public methodGetHashCodeServes as a hash function for a particular type. (Inherited from Object.)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Public methodMapUriConverts a specified uniform resource identifier (URI) into a new URI based on the rules of a matching object in the UriMappings collection. (Overrides UriMapperBase.MapUri(Uri).)
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)
Top

You use the UriMapper class to store the collection of UriMapping objects to use for converting a requested URI to another URI. You define the UriMapper object and its collection of UriMapping objects for a frame by assigning the UriMapper object to the UriMapper property of the frame.

The UriMappings property contains the collections of mapping objects. The MapUri method converts a requested URI to the new URI based on the mappings you defined in objects you added to the UriMappings property.

Typically, you will not need to programmatically call the MapUri method. The Silverlight framework automatically calls the MapUri method for each request when you have added an instance of the UriMapper class to your application.

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>


Silverlight

Supported in: 5, 4, 3

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

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

Show:
© 2014 Microsoft. All rights reserved.