11智能在线
新记
WPF 如何获取ListBoxItem 的获得ListBox对象呢?
用listBoxItem.Parent方法不行
举报该文章
相关建议 推荐于2016-09-28
测试了Parent可行,如下:
//取ListBoxItem
ListBoxItem item = this.listBox1.Items[0] as ListBoxItem;
MessageBox.Show(item.Content.ToString());
//反过来取ListBox
ListBox parent = item.Parent as ListBox;
MessageBox.Show(parent.Name);
温馨提示:内容为网友见解,仅供参考
当前网址:
https://11.t2y.org/zz/f8v2mmsvmpp4m44q72.html
其他看法
无其他回答
相似回答
大家正在搜
相关问题
C#/WPF高手进!如何获取ListBox的Item的高度。
C# Winform, ListBox 如何获取 ListB...
【WPF】ListBox如何获取选中的内容!能解决问题,我可...
c#如何获取listbox中项的值
如何在listbox中获得选定项的集合?
c#wpf读出来数据怎样显示在listbox
wpf 在listBox后台怎么取Template里面元素的...
C#中ListBox的Items属性是Object对象,如何...