Compartilhar via


Frame.Source Property

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

Gets or sets the uniform resource identifier (URI) of the current content or the content that is being navigated to.

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

Syntax

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

Property Value

Type: System.Uri
A value that represents the URI of the current content or the content that is being navigated to.

Remarks

Dependency property identifier field: SourceProperty

When you set the Source property to a value that is different from the content being displayed, the frame navigates to the new content.

Examples

The following example shows the XAML for a frame that includes URI mapping definitions. The frame will navigate to the value of its Source property, which in this example is set by default to /Home.

<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.