WPF 从ListBox .SelectedItem 中获取ListBoxItem
2011-08-25 09:53
483 查看
转自:http://geekswithblogs.net/thibbard/archive/2008/02/13/wpf---get-listboxitem-from-listbox.selecteditem.aspxIhadsometroubletodaygettingtheactualcontrolthathostsdatainaWPFlistbox.ThemagicclassisListBox.ItemContainerGeneratorusedlikethis:
MyStateObjectcurrent=this.myListBox.SelectedItemasMyStateObject; ListBoxItemlbi=this.myListBox.ItemContainerGenerator.ContainerFromItem(current)asListBoxItem; lbi.Margin=newThickness(10);
相关文章推荐
- WPF开发中遇到的问题及解决系列(二):如何获取通过binding生成的ComboBox或者ListBox等的Item
- 选中ListBoxItem中的TextBox后,如何改变ListBox的SelectedItem?
- WPF:ListBox 利用ItemContainerStyle改变ListBoxItem样式
- WPF ListBox 获取listBoxItem
- WPF关于改变ListBoxItem的颜色的注意事项以及如何找到ListBox中的ItemsPanel
- WPF绑定的ListBox获取ListBoxItem及GoToState应用
- WPF学习笔记:获取ListBox的选中项
- 获取列表(ListBox)控件的当前文本、item数量等
- WPF中确保显示ListBox选中的Item
- wpf 中 用 SelectedDate属性获取DatePicker 控件的日期 3ff0
- Symbian中获取ListBox当前列表项(ListBoxItem)中的文本的实现方法
- WPF问题 - treeview ContainerFromItem无法获取TreeViewItem
- WPF ListBox ItemContainerStyle 设置BackGround 和 BorderBrush 无效
- WPF学习笔记:获取ListBox的选中项
- WPF-Listbox-ListboxItem双击事件实现-MVVM模式
- WPF Combox selectedItem”不能绑定”的问题
- 为listbox的SelectedItem加入翻转动画(附源码)
- 为ListBox的SelectedItem添加动画(附源码)
- wpf DataGrid.SelectedItem返回null
- [转]右键点击树控件的一项时候GetSelectedItem获取值错误问题