如何将SelectedItem绑定到ListView.

编程入门 行业动态 更新时间:2024-10-21 03:56:52
本文介绍了如何将SelectedItem绑定到ListView.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

大家好,

我正在使用ListView,并且我想绑定SelectedItem Defualt,但它无法正常工作,我的XAML就是这样

I am working with ListView and I want to Bind SelectedItem Defualt but it will not working my XAML is like this

<ListView x:Name="MenuBarList" ScrollViewer.HorizontalScrollBarVisibility="Disabled" Height="{Binding MainMenuHeight}" Width="{Binding MainMenuWidth}" ItemsSource="{Binding}" SelectedItem="{Binding Path=SelectedMainMenuOption, Mode=TwoWay}" Foreground="White" Background="#FF3D61D0" SelectionMode="Single">

因此,SelectedMainMenuOption是Property,但是它不起作用,是否有任何解决方法,所以我可以非常感谢您..

so the SelectedMainMenuOption is the Property but it is not working is there any workaround so I can goahead thank you very much..

推荐答案

u需要设置 SelectedMainMenuOption 是

u need to set theSelectedMainMenuOption property to the one of the possible values in the

itemsource

itemsource

请放下代码以更好地理解该问题.

更多推荐

如何将SelectedItem绑定到ListView.

本文发布于:2023-11-06 14:16:56,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1563920.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:绑定   如何将   SelectedItem   ListView

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!