如何在Metro应用程序中设置Listview项目的焦点? [英] how to set a focus of Listview item in Metro apps?
本文介绍了如何在Metro应用程序中设置Listview项目的焦点?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的metro-app中有一个listview。我想在listview中设置最后一项的焦点?我如何设置listview-item的焦点?有人可以帮助我吗?
I have a listview in my metro-app.I want to set a focus of last-item in my listview?How can I set a focus of a listview-item?Can anyone help me?
谢谢。
推荐答案
你需要使用ListViews currentItem
property:
http: //msdn.microsoft.com/en-us/library/windows/apps/hh700672.aspx
You need to use the ListViews currentItem
property:
http://msdn.microsoft.com/en-us/library/windows/apps/hh700672.aspx
具体来说,为它指定一个索引为您想要选择的数据项(来自您的数据源),以及 hasFocus
和 showFocus
属性设置:
Specifically, assign it an object with the index of the data item you want selected (from your data source), and the hasFocus
and showFocus
properties set:
var yourListView = getYourListViewFromSomewhere();
yourListView.currentItem = { index: 8, hasFocus: true, showFocus: true }
这篇关于如何在Metro应用程序中设置Listview项目的焦点?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文