简体   繁体   English

在XAML中更改页眉文本

[英]Changing the page header text in XAML

How do I change the default page header in a Windows 8 XAML application? 如何更改Windows 8 XAML应用程序中的默认页眉? The question is simple, just I am still learning XAML. 问题很简单,只是我还在学习XAML。

<Page.DataContext>
    <local:MainPageViewModel/>
</Page.DataContext>
<!-- PageAdornerControl displays the back button and a page title -->
<Layout:PageAdornerControl
        Background="{StaticResource ApplicationPageBackgroundThemeBrush}"
        Header="{Binding Header}">

I see Header as the text. 我认为Header是文本。 My first thought was to change {Binding Header} to {Binding }, however a mouse over on Header shows that as some valid whatever. 我的第一个想法是将{Binding Header}更改为{Binding},但是Header上的鼠标显示为某些有效的东西。 Also, I would like to use the Visual Studio 2012 properties window to change the text. 另外,我想使用Visual Studio 2012属性窗口来更改文本。

There might be other ways, and I am still less than green with XAML, but here is one way using Nate's pageAdornerControl method. 可能还有其他方法,而且我对XAML仍然不太绿,但这是使用Nate的pageAdornerControl方法的一种方法。

  1. Place the cursor on the Layout:PageAdornerControl in the XAML code area. 将光标放在XAML代码区域中的Layout:PageAdornerControl上。
  2. Go to the properties window, which should show the type as PageAdornerControl. 转到属性窗口,该窗口应将类型显示为PageAdornerControl。
  3. Scroll down to header 向下滚动到标题
  4. From the dropdown list, select Go to Source 从下拉列表中,选择“转到源”
  5. You will now see another section of code highlighted. 您现在将看到另一部分代码突出显示。
  6. Go to the properties window and the Header attribute will be the actual header text, which you can edit. 转到属性窗口,Header属性将是您可以编辑的实际标题文本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM