| ページ一覧 | ブログ | twitter |  書式 | 書式(表) |

MyMemoWiki

差分

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

案内メニュー