Good morning,
I am trying to access and change the enabled state of a button in the buttonsRight collection. How can I access the specific button?
Thanks,
Hello Michael.
The ButtonsRight Collection can be accessed via the designer by right-clicking the flyout arrow (Tasks) option and choosing ButtonsRight under the Misc section.
There you can add and modify a StateEditorButton by clicking the down arrow on the "Add button" within the EditorButtonBase Collection Editor.
After the button is added to the collection you can modify it's behavior properties such as Checked, CheckState, Enabled and so forth to meet your requirements.
Here is the example done at runtime.
Infragistics.Win.UltraWinEditors.StateEditorButton stateEditorButton1 = new Infragistics.Win.UltraWinEditors.StateEditorButton(); stateEditorButton1.CheckState = System.Windows.Forms.CheckState.Checked; stateEditorButton1.Enabled = false; this.ultraComboEditor1.ButtonsRight.Add(stateEditorButton1);
Let me know if you have any questions regarding this matter.
Creating and setting the initial information I have done. I used the designer for that. My issue is that I want to set the enabled state during runtime to change based on the value of the editor field. Essentially I want the button to be disabled when the field is blank.
Hello Michael,
You'll to need to cast a new instance of StateEditorButton with your tool's ButtonsRightCollection to access and modify your designer generated StateEditorButton
public StateEditorButton designerStateButton; designerStateButton = (StateEditorButton)this.ultraComboEditor1.ButtonsRight["name of editor"] as StateEditorButton;
I attached a sample demonstrating this for both scenarios.
1. Designer generated 2. Runtime generated
The goal is to check immediately (form_load) whether or not the Combo is empty as well as handling it's ValueChanged event to toggle the Enabled property, and other properties, accordingly when it's filled-in.
Please review my sample and let me know if you have any questions.