PhoneApplicationPage中的PhoneApplicationFrame

时间:2013-08-05 13:53:09

标签: wpf xaml windows-phone-8 master-pages frame

我对Windows Phone 8页面结构有一个尴尬的问题。 我想在网站上使用一些名称为MasterPage的结构 我有一个MasterPage的页面,我想为内容添加一个框架。 但是当我尝试这样做时,我得到了一个错误 “由于对象的当前状态,”操作无效“

xaml代码如下。 谢谢你的帮助。

<phone:PhoneApplicationPage x:Class="Teknosa.Phone.Views.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:ignore="http://www.ignore.com"
    xmlns:manager="clr-namespace:Teknosa.Phone.Managers"
    mc:Ignorable="d ignore"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    SupportedOrientations="Portrait"
    Orientation="Portrait"
    shell:SystemTray.IsVisible="True">


    <!--Frame contains the root where all other page content is placed-->
    <phone:PhoneApplicationFrame x:Name="ContentFrame" >

    </phone:PhoneApplicationFrame>
</phone:PhoneApplicationPage>

1 个答案:

答案 0 :(得分:0)

您无法将应用程序框架放在另一个应用程序框架中。实际上,您的应用程序中只能有一个PhoneApplicationFrame。代码的设置将导致无限的嵌套条件。 PhoneApplicationFrame托管PhoneApplicationPage,其中托管PhoneApplicationFrame,依此类推。这是无限的,这是你不被允许这样做的原因。

如果您只是尝试导航到网页,则可以使用手机内置的网络浏览器。

<phone:PhoneApplicationPage x:Class="Teknosa.Phone.Views.MainPage"
   xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
   xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
   xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
   xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
   xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
   xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
   xmlns:ignore="http://www.ignore.com"
   xmlns:manager="clr-namespace:Teknosa.Phone.Managers"
   mc:Ignorable="d ignore"
   FontFamily="{StaticResource PhoneFontFamilyNormal}"
   FontSize="{StaticResource PhoneFontSizeNormal}"
   Foreground="{StaticResource PhoneForegroundBrush}"
   SupportedOrientations="Portrait"
   Orientation="Portrait"
   shell:SystemTray.IsVisible="True">
    <Grid>
        <phone:WebBrowser Source="<URL or binding>"/>
    </Grid>
</phone:PhoneApplicationPage>