简体   繁体   English

在Windows 8中动态更改标题文本

[英]Changing the title text dynamically in Windows 8

In the app preview for the Bing Weather app in the Windows 8 release preview, the title text changes automatically when the "view" changes (ie when scrolling). 在Windows 8版本预览中的Bing Weather应用程序的应用程序预览中,标题文本将在“视图”更改时(即,滚动时)自动更改。

My app currently has two ListBox items inside a Grid item, wrapped with a ScrollViewer element. 我的应用程序当前在Grid项内有两个ListBox项,并用ScrollViewer元素包装。 I want the title to change according to which of the ListBoxes is currently in view. 我想根据当前正在查看的ListBoxes来更改标题。

Suggestions of different UI elements or layouts are also welcome 也欢迎提出不同UI元素或布局的建议

What if you try to use Height properties of ListBoxes and ScrollViewer? 如果您尝试使用ListBoxes和ScrollViewer的Height属性怎么办?

I mean you know the height of ScrollViewer. 我的意思是您知道ScrollViewer的高度。 So after scrolling you need to check if ScrollViewer's offset (eg VerticalOffset ) is more than Height (or maybe ActualHeight , it depends on your markup) of, let's say, 1st ListBox. 因此,在滚动之后,您需要检查ScrollViewer的偏移量(例如, VerticalOffset )是否大于(例如1st ListBox的) 高度 (或者,取决于您的标记的ActualHeight )。

That way you will know if 1st ListBox is not visible, so the 2nd ListBox is in scope and you can change Title. 这样,您将知道第一个列表框是否不可见,因此第二个列表框在范围内,您可以更改标题。

I hope my point is clear for you. 我希望我的观点对您清楚。

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

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