你可以在获取焦点事件中加上代码
- private void Grid1_PrepareCellForEdit_1(object sender, C1.WPF.FlexGrid.CellEditEventArgs e)
- {
- if ((e.Column > 1))
- {
- Border _border;
- var edit = e.Editor as System.Windows.FrameworkElement;
- _border = edit as System.Windows.Controls.Border;
- C1.WPF.FlexGrid.C1FlexComboBox cmb = ((C1.WPF.FlexGrid.C1FlexComboBox)(_border.Child));
- cmb.DropDownItems = new string[] { "Assigned", "Remove", "- -" };
- cmb.IsEditable = false;
- cmb.GotFocus += (s, ee) =>
- {
- if (!cmb.IsDroppedDown)
- {
- cmb.IsDroppedDown = true;
- }
- };
- cmb.LostFocus += (s, ee) =>
- {
- if (cmb.IsDroppedDown)
- {
- cmb.IsDroppedDown = false;
- }
- };
- }
- }
复制代码 |