I define a ComboBox which inherit from UltraTextEditor with the dropdownbuttoneditor.
In winForm It works as UltraCombo,but set it as a editorcontrol to the ultragirdcolumn,It can't work as i expected,the problem is:
1.The popcontrol in UltraTextEditor is poped coording by clicking button editor,I select an item but the popControl is visible remaning
2.When the gridcell is foused,the Popcontrol can not pop for user to select. In other words, I want the popcontrol visible after key down in the gridcell
What can I do for this? Thanks
You would not use any properties of the UltraTextEditor here. That would not make sense. The grid can have many cells, but there is only one UltraTextEditor control servicing the entire column. So using a single property on the UltraTextEditor would not work.
When the user selects an item from your list, you would handle some event of the control on the dropdown and set the grid.ActiveCell.Value accordingly and close the dropdown.
Hi Mike,
My GridCombo inherit from UltraTextEditor. I use the Tag of UltraTextEditor as Value. Now the problem is How to set the value of Gridcombo to the ultragridcell.value and to show text of Gridcombo in ultragridcell after user selecting a row in gridcombo. In addition, how the ultragridcell shows the relevant text when the user set a value to ultragridcell.value?
[DefaultBindingProperty("Value")] public partial class GridCombo : UltraTextEditor { #region Properties
private DataTable _dataSource; private string _valueMember = "Id"; private string _displayMemeber = "Name"; public event EventHandler OnInit; private bool _isInitailized = false;
/// <summary> /// Data Source of this Control /// </summary> [Bindable(true)] [Browsable(true)] public DataTable DataSource { get { return _dataSource; } set { _dataSource = value; popGrid1.dataGridView1.DataSource = value; //popGrid1 is a userpanel having a dataGridView and several buttons } }
/// <summary> /// Value of this Control /// </summary> [Bindable(true)] [Browsable(true)] public object Value { get { return Tag; } set { if (DesignMode) return; DataGridViewRow row = GetViewRow(value); SelectRow(row); } }
/// <summary> /// Value data field in the data source /// </summary> public string ValueMember { get { return _valueMember; } set { _valueMember = value; } }
/// <summary> /// Display data field in the data source /// </summary> public string DisplayMemeber { get { return _displayMemeber; } set { _displayMemeber = value; } }
#endregion
#region Constructor
public GridCombo() { InitializeComponent(); }
#region Event
.........................
protected override void OnCreateControl() { base.OnCreateControl(); if (DesignMode || ButtonsRight.Exists("DropDownButton")) return;
DropDownEditorButton editorButton = new DropDownEditorButton(); editorButton.Key = "DropDownButton"; editorButton.RightAlignDropDown = Infragistics.Win.DefaultableBoolean.False; editorButton.AutoFocus = false; editorButton.Control = popGrid1;
ButtonsRight.Add(editorButton); }
.................
}
I'm afraid I still do not understand.
If you are using a DropDownEditorButton in an UltraTextEditor, then it will drop down the list automatically when the user clicks on the button. So why do you need to call the DropDown method? Assuming that you do need to do this, there's no way around specifying the grid control.
To close the DropDown, you can use hte code you have here that refers to the ActiveCell of the grid, or you can close all open dropdowns using:
DropDownManager.CloseDropDown(null);
In fact, I can use
"((this.ultraGrid1.ActiveCell.EditorResolved as EmbeddableEditorButtonBase).ButtonsRight[0] as DropDownEditorButton).DropDown();"
and
"((this.ultraGrid1.ActiveCell.EditorResolved as EmbeddableEditorButtonBase).ButtonsRight[0] as DropDownEditorButton).CloseUp();"
to control the gridcombo to dropdown and closeup.But This's a bad method because I must write the same code for every ultragrid.
More, ultracomboeditor and ultratexteditor inherit from TextEditorControlBase.Ultracomboeditor can work well in UltraGrid,just like it works in a form,But the Gridcombo I defined which inherits form ultratexteditor can't work as Ultracomboeditor works in UltraGrid.So I think I can override some properties and some methods to settle my problem,Can I?
I say, I want to add some buttons under the pop UltraGrid in the Ultracombo.if several buttons are in the ultracombo,the ultracombo will be hard to look,also no some space to show its text.
More detail can visit http://sites.google.com/site/tidgeli/blog
Thanks.