DataGrid中的Combox输入信息模糊查询,后焦点离开获取不到值.
我输入f时间他模糊查询,焦点离开后,要把选择的值信息带地去.
但是在grid里的这种combox不好使
如下部分代码.到element 就为空了,为什么?
if (ItemDG.CurrentCell.Column == null)
return null;
int index = ItemDG.CurrentCell.Column.DisplayIndex;
DataGridTemplateColumn templeColumn = ItemDG.Columns[index] as DataGridTemplateColumn;
if (templeColumn == null) return null;
object item = ItemDG.CurrentCell.Item;
FrameworkElement element = templeColumn.GetCellContent(item);
if (element == null)
return null;
ComboBox itemcombox = templeColumn.CellTemplate.FindName("itemCB", element) as ComboBox;
if (itemcombox == null)
return null;
Lepus.Model.ItemModel model = itemcombox.SelectedItem as Lepus.Model.ItemModel;
return model;