本主题包括下列各节。
![]()
![]()
![]()
|
![]() |
---|
|
pack://siteoforigin:,,,/SiteOfOriginFile.xaml
pack://siteoforigin:,,,/Subfolder/SiteOfOriginFile.xaml
pack://application:,,,/ResourceFile.xaml
/ResourceFile.xaml
![]() |
---|
|
App.xaml
Page2.xaml
\SubFolder
+ Page1.xaml
+ Page2.xaml
Page2.xaml
/Page2.xaml
pack://application:,,,/ResourceOrContentFile.xaml
/ResourceOrContentFile.xaml
<element attribute="pack://application:,,,/File.xaml" />
|
|
---|---|
|
"pack://application:,,,/ResourceFile.xaml" |
|
"pack://application:,,,/Subfolder/ResourceFile.xaml" |
|
"pack://application:,,,/ReferencedAssembly;component/ResourceFile.xaml" |
|
"pack://application:,,,/ReferencedAssembly;component/Subfolder/ResourceFile.xaml" |
|
"pack://application:,,,/ReferencedAssembly;v1.0.0.0;component/ResourceFile.xaml" |
|
"pack://application:,,,/ContentFile.xaml" |
|
"pack://application:,,,/Subfolder/ContentFile.xaml" |
|
"pack://siteoforigin:,,,/SOOFile.xaml" |
|
"pack://siteoforigin:,,,/Subfolder/SOOFile.xaml" |
|
|
---|---|
|
"/ResourceFile.xaml" |
|
"/Subfolder/ResourceFile.xaml" |
|
"/ReferencedAssembly;component/ResourceFile.xaml" |
|
"/ReferencedAssembly;component/Subfolder/ResourceFile.xaml" |
|
"/ContentFile.xaml" |
|
"/Subfolder/ContentFile.xaml" |
Uri uri = new Uri("pack://application:,,,/File.xaml");
Uri uri = new Uri("/File.xaml");
// Absolute URI (default) Uri absoluteUri = new Uri("pack://application:,,,/File.xaml", UriKind.Absolute); // Relative URI Uri relativeUri = new Uri("/File.xaml", UriKind.Relative);
// Relative or Absolute URI provided by user via a text box TextBox userProvidedUriTextBox = new TextBox(); Uri uri = new Uri(userProvidedUriTextBox.Text, UriKind.RelativeOrAbsolute);
Uri uri = new Uri("pack://application:,,,/ResourceFile.xaml", UriKind.Absolute); | |
Uri uri = new Uri("pack://application:,,,/Subfolder/ResourceFile.xaml", UriKind.Absolute); | |
Uri uri = new Uri("pack://application:,,,/ReferencedAssembly;component/ResourceFile.xaml", UriKind.Absolute); | |
Uri uri = new Uri("pack://application:,,,/ReferencedAssembly;component/Subfolder/ResourceFile.xaml", UriKind.Absolute); | |
Uri uri = new Uri("pack://application:,,,/ReferencedAssembly;v1.0.0.0;component/ResourceFile.xaml", UriKind.Absolute); | |
Uri uri = new Uri("pack://application:,,,/ContentFile.xaml", UriKind.Absolute); | |
Uri uri = new Uri("pack://application:,,,/Subfolder/ContentFile.xaml", UriKind.Absolute); | |
Uri uri = new Uri("pack://siteoforigin:,,,/SOOFile.xaml", UriKind.Absolute); | |
Uri uri = new Uri("pack://siteoforigin:,,,/Subfolder/SOOFile.xaml", UriKind.Absolute); |
Uri uri = new Uri("/ResourceFile.xaml", UriKind.Relative); | |
Uri uri = new Uri("/Subfolder/ResourceFile.xaml", UriKind.Relative); | |
Uri uri = new Uri("/ReferencedAssembly;component/ResourceFile.xaml", UriKind.Relative); | |
Uri uri = new Uri("/ReferencedAssembly;component/Subfolder/ResourceFile.xaml", UriKind.Relative); | |
Uri uri = new Uri("/ContentFile.xaml", UriKind.Relative); | |
Uri uri = new Uri("/Subfolder/ContentFile.xaml", UriKind.Relative); |
<Application xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" StartupUri="MainWindow.xaml" />
<Application xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" StartupUri="HomePage.xaml" />
<Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" WindowTitle="Page With Hyperlink" WindowWidth="250" WindowHeight="250"> ... <Hyperlink NavigateUri="UriOfPageToNavigateTo.xaml"> Navigate to Another Page </Hyperlink> ... </Page>
<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Class="SDKSample.MainWindow" Icon="WPFIcon1.ico"> </Window>
<MediaElement Stretch="Fill" LoadedBehavior="Play" Source="pack://siteoforigin:,,,/Media/bee.wmv" />
<MediaElement Stretch="Fill" LoadedBehavior="Play" Source="pack://siteoforigin:,,,/Media/ringin.wav" />
<Image Source="Images/Watermark.png" />
<Application xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" StartupUri="HomePage.xaml"> <Application.Resources> <ResourceDictionary Source="pack://siteoforigin:,,,/PageTheme.xaml" /> </Application.Resources> </Application>
|
来自: 昵称11482448 > 《WPF》