==Sliverlight 画面遷移==
[[Sliverlight][VisualStudio][C#]]
*http://code.msdn.microsoft.com/10-C-Silverlight-b4de09ed
*Silverlight のようなプラグインを使って Web ページに組み込まれたアプリケーションは、その状態に関わらず URL が変わりません
====ハイパーリンクボタンの設置====
*ハイパーリンクボタンを設置し、追加したページへのURIを指定する
<<HyperlinkButton Content="Test" Name="hyperlinkButton1" NavigateUri="/Views/Test.xaml" />>
====ページを表示する、Frameの設置====
<<navigation:Frame />>
====実行====
*この状態で、リンクをクリックすると、Frameにページが読み込まれる
====URIマッピング====
*URIの指定が長くなるような場合、簡潔な表記を割り当てられる
<<UserControl.Resources>> <<uriMapper:UriMapper x:Key="uriMapper">> <<uriMapper:UriMapping Uri="" MappedUri="/Views/HomePage.xaml" />> <<uriMapper:UriMapping Uri="Home" MappedUri="/Views/HomePage.xaml" />> <<uriMapper:UriMapping Uri="Info" MappedUri="/Views/InfoPage.xaml" />> <<uriMapper:UriMapping Uri="About" MappedUri="/Views/AboutPage.xaml" />> <</uriMapper:UriMapper>> <</UserControl.Resources>>
<<Grid x:Name="LayoutRoot">>
:
<<StackPanel Grid.Row="0" Orientation="Horizontal" Background="LightCyan">> <<HyperlinkButton Content="Home" NavigateUri="Home" />> <<HyperlinkButton Content="Info" NavigateUri="Info" />> <<HyperlinkButton Content="About" NavigateUri="About" />> <</StackPanel>>
<<navigation:Frame Grid.Row="1" Background="LightYellow" UriMapper="{StaticResource uriMapper}"/>> <</Grid>>
====URIマッピングによりパラメータを渡す====
*URI マッピングでは、単純に文字列を置き換えるだけでなく、パラメーターを渡すこともできます
*Uri プロパティとして「/」を指定した後に「{}」で囲んだ引数を、マッピング先の MappedUri に渡せます
:
<<uriMapper:UriMapping Uri="About" MappedUri="/Views/AboutPage.xaml" />> <<uriMapper:UriMapping Uri="/{arg}" MappedUri="/Views/InfoPage.xaml?arg={arg}" />> <</uriMapper:UriMapper>>
*これは「/」の直後に渡されたパラメーターを「/Views/InfoPage.xaml?arg=」の後ろに追加してナビゲーションするという意味です
=====パラメータを受け取る=====