Hello
Can’t CloseUp Event with the DropDownEditorButton.
I have a populate ultraGrid column with a UserControl, I am using a ultraTextEditor1 and a DropDownEditorButton to halp me to get the punctuality of a dropdown to my control in the grid column.
-----------------------------------------------------------------------------------------------------------||
The cod in the grid column:
DropDownEditorButton b = new DropDownEditorButton(); //Dropdown Editor Button
b.Control = _workingHoursPicker; //The Multi Select "Combo" with the userCuntrol
if (_workingHoursPicker.Owner == null)
_workingHoursPicker.Owner = b;
this.ultraTextEditor1.ButtonsRight.Add(b); //add the button to the editor control
Problem:
The cod in my UserControl;
private void saveToolStripButton_Click(object sender, EventArgs e)
{
_owner.CloseUp(); -- not responding
}
Regards:
Yaniv l
What is _owner?
public partial class WorkingHoursPicker : UserControl
/// <summary>
/// Gets and Sets the Owner control
/// </summary>
Please if you have more question
Regards
I don't think what you are doing here will work. You are essentially give your UserControl a reference to the EditorButton in the ButtonsRight collection of the UltraTextEditor Control. The problem is that the cell in the grid is not using the control. The grid cell is using an editor that is provided by the UltraTextEditor control. It's essentially a clone of it's internal editor and therefore a clone of the button.
So there are a couple of ways you can go with this. For most application, this will work just fine:
DropDownManager.CloseDropDown(null);
The DropDownManager is a static class, and by passing in null, you tell it to just close whatever dropdowns happen to be open. This is usually suficient since in most applications, you will never have more than one dropdown open at a time, anyway.
An alternative would be to trap the AfterEditorButtonDropDown event of the UltraTextEditor.The e.Context param in this event will return the grid cell. You can then get EditorResolved on the cell, cast that into an EditorButtonBase and get the ButtonsRight collection to get the dropdown button. From there you could get the Control property to get your usercontrol and then assign the UserControl.Owner to the button itself.
Thanks it’s solved the problem.
Yaniv.l