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
I'm having a hard time understanding your questions.
1) It sounds like you are saying that the dropdown is not closing when you select an item. If that's the case, then the question is, how are you closing the dropdown? The DropDown will not be able to close by itself, so you must be closing it in code and the code must be doing something wrong. My guess is that you are calling the CloseUp method on the DropDownEditorButton that is in the UltraTextEditor control and not the DropDownEditorButton in the grid cell. They are two different things. I beleive there's a static methodto close all dropdown buttons, too, which would probably be easier, assuming you don't have multiple dropdowns visible at the same time.
2) Again, it sounds like your code is probably trying to drop down the button in the control instead of the grid cell. You need to get the EditorResolved from the grid cell (probably grid.ActiveCell) and then use the ButtonRight collection of the editor to get thet actual DropDownEditorButton inside the grid cell.
Hi Mike,
I'm sorry for my poor English,also Thank you very must.
Now I meet a lot of problems in this subject which set a combo I define as an embeded control for ultragrid.
Can I add a Panel or some components under the grid of the ultracombo?
Thank you!
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.
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'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);
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); }
.................
}
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.