Designer抛出NullReferenceException

时间:2013-01-21 07:02:59

标签: xaml pivot windows-phone-8 itemtemplate

我需要的是将项目边框设置为10。

Designer视图继续抛出异常,因此我无法继续。

<phone:Pivot.ItemTemplate>
    <DataTemplate>
        <phone:PivotItem Margin="10"/>
    </DataTemplate>
</phone:Pivot.ItemTemplate>

这段代码出了什么问题?

1 个答案:

答案 0 :(得分:0)

抱歉,我没有意识到这是WP8。在WP8上,phone Pivots的默认命名空间。这虽然很随意。你确定问题不在其他地方吗?分享你的XAML对你来说仍然有帮助,但这里有一些对我有用:

<phone:Pivot>
    <phone:Pivot.ItemTemplate>
        <DataTemplate>
            <phone:PivotItem Margin="10">
                <Grid>
                    <!--Contents of template-->
                </Grid>
            </phone:PivotItem>
        </DataTemplate>
    </phone:Pivot.ItemTemplate>
    <phone:PivotItem Header="Hello">
        <Grid>
            <!--Contents of "Hello" item-->
        </Grid>
    </phone:PivotItem>
    <phone:PivotItem Header="World">
        <Grid>
            <!--Contents of "World" item-->
        </Grid>
    </phone:PivotItem>
</phone:Pivot>