0

Silverlight アプリケーションを作成したところ、MainPage.xaml が作成されていることがわかります。ただし、これはUserControl.

そこで、通常のページを作成できると考えて、 App.xaml.cs を set に変更しましたthis.RootVisual = new MyNewMainPage()

MyNewMainPage は、SilverlightPageを継承しPageます。ただし、このアプリケーションを起動すると、次の例外がスローさInitializeComponent()MyNewMainPage.xaml.csます:

Failed to assign to property 'System.Windows.UIElement.Tap'. [Line: 10 Position: 35]

10行目で私は持っています:

<Grid x:Name="LayoutRoot" Tap="LayoutRoot_Tap">

メソッドはコード ビハインドで作成されます。どうしてこれなの。UserControl の代わりにページを使用する理由は、いくつかのナビゲーションが必要で、複数のページがあるためです。

4

1 に答える 1

0

mainPage に を追加するFrameと、ここでページがホストされます。UriMapperは、ページナビゲートする方法です。

 <navigation:Frame x:Name="ContentFrame" Source="/Home" Navigated="ContentFrame_Navigated" NavigationFailed="ContentFrame_NavigationFailed" Width="Auto" Height="755" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" MaxWidth="Infinity" MaxHeight="755" HorizontalContentAlignment="Left" VerticalContentAlignment="Top">
    <navigation:Frame.UriMapper>
      <uriMapper:UriMapper>
         <uriMapper:UriMapping Uri="/Home" MappedUri="/Views/Home.xaml"/>
      </uriMapper:UriMapper>
    </navigation:Frame.UriMapper>
 </navigation:Frame>
于 2013-08-09T20:25:39.793 に答える