PivotItem的标题始终是Saying First

时间:2015-12-31 07:56:36

标签: c# xaml windows-phone-8.1

每当我调试应用程序时,无论我对PivotItem的标题做什么,它都会说" first",并且Pivot的标题总是说" MY应用"

代码:

PivotPage.xaml

<Pivot x:Uid="Pivot" Title="THE BOX" x:Name="pivot">
    <!--Pivot item one-->
    <PivotItem
        x:Uid="PivotItem1" Header="The Box" 
        Margin="19,14.5,0,0" CommonNavigationTransitionInfo.IsStaggerElement="True">
    </PivotItem>
</Pivot>

更新: 我在代码隐藏中没有发现影响这种行为的任何内容:

PivotPage.xaml.cs

public sealed partial class PivotPage : Page, INotifyPropertyChanged
{    
    private readonly NavigationHelper navigationHelper;
    private readonly ResourceLoader resourceLoader =
        ResourceLoader.GetForCurrentView("Resources");

    public event PropertyChangedEventHandler PropertyChanged;

    public PivotPage()
    {
        this.InitializeComponent();
        DataContext = this;
        this.NavigationCacheMode = NavigationCacheMode.Required;

        this.navigationHelper = new NavigationHelper(this);
        this.navigationHelper.LoadState += this.NavigationHelper_LoadState;
        this.navigationHelper.SaveState += this.NavigationHelper_SaveState;
    }

    /// <summary>
    /// Gets the <see cref="NavigationHelper"/> associated with this <see cref="Page"/>.
    /// </summary>
    public NavigationHelper NavigationHelper
    {
        get { return this.navigationHelper; }
    }

    private async void NavigationHelper_LoadState(object sender, LoadStateEventArgs e)
    {

    }

    private void NavigationHelper_SaveState(object sender, SaveStateEventArgs e)
    {
        // TODO: Save the unique state of the page here.
    }

    /// <summary>
    /// Adds an item to the list when the app bar button is clicked.
    /// </summary>
    private void AddAppBarButton_Click(object sender, RoutedEventArgs e)
    {
        Box = Note.MakeTable();
    }

    private void OnPropertyChanged(string property_name)
    {
        if (PropertyChanged != null)
        {
            PropertyChanged(this, new PropertyChangedEventArgs(property_name));
        }
    }

    #region NavigationHelper registration

    protected override void OnNavigatedTo(NavigationEventArgs e)
    {
        this.navigationHelper.OnNavigatedTo(e);
    }

    protected override void OnNavigatedFrom(NavigationEventArgs e)
    {
        this.navigationHelper.OnNavigatedFrom(e);
    }

    #endregion

    private void MakeTable(object sender, TappedRoutedEventArgs e)
    {
        Box = Note.MakeTable();
    }

    private void Button_Click(object sender, RoutedEventArgs e)
    {
        Box = Note.MakeTable();
    }
}

截图

enter image description here

1 个答案:

答案 0 :(得分:2)

您需要从控件中删除 http://plnkr.co/edit/LjrqDMolGoaQn96ds6fv?p=preview 参数才能使用指定的文字。

或修改 x:Uid 文件中的值。