导航到列表视图时如何禁用列表视图中的默认选择 [英] how to disable the default selection in listview when you navigate to it

查看:20
本文介绍了导航到列表视图时如何禁用列表视图中的默认选择的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在一个场景中有两个列表视图(listview1 和 listview2,listview2 的内容取决于 listview1 上的 selecteditem),当我导航到场景时,我希望选择 listview1 中的第一个项目,详细信息显示在其他列表视图 (listview2) 但我不希望默认选择 listView2 中的任何项目.

I have two list views in a scene (listview1 and listview2, contents of listview2 depends on the selecteditem on listview1) and when I navigate to the scene I want the first item in listview1 to be selected and the details be displayed in the other listview (listview2) but I do not want any item in the listView2 selected by default.

我观察到的是 listView2 中的第一项也被选中,这导致为 listview2 触发 selectionchanged 事件(我只想在用户明确选择它时触发)

What i am observing is that the first item in listView2 is also selected and that is causing selectionchanged event to be triggered for listview2 (which I want to be triggered only if the user explicitly selects it)

推荐答案

不需要变通办法.只需在 ListView 中设置 IsSynchronizedWithCurrentItem="False".这也适用于 GridView.

No need for workarounds. Just set IsSynchronizedWithCurrentItem="False" in your ListView. This also works for GridViews.

这篇关于导航到列表视图时如何禁用列表视图中的默认选择的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆