Is it possible to bind the SharedProps.Enabled property of a button that resides on a toolbar to a property of the active row of a UltraWinGrid that's on the same form? I want a button to be automatically enabled or disabled depending on the row selected.
Hi,
I just wanted to know if you was able to solve this using Mike's suggestions or you still need help? Just let me know. Thank you.
Sincerely,DimiDeveloper Support Engineer, MCPD Infragistics, Inc.
How do you capture a specific button on the toolbar so you can enable or disable it?
Eg - I have 3 buttons on the toolbar and the second one should be enabled or disabled based on the result of a boolean function exposed in a controller.
I am using the AfterRowActivate event as suggested above, and when the event is fired I pass through the current collection of selected items in an ultragrid to a controller function. The function assesses the collection and returns true or false based on some business logic. So, if the function returns false I want to disable the second button or enable it if the result is true.
Does that make sense??
Hello,I am not sure what exactly is making you trouble with the captioning the toolbar button.Very simply you can take the Button tool by key and set the desired property, for example: this.ultraToolbarsManager1.Toolbars[0].Tools["ButtonTool2"].SharedProps.Enabled = false;If you don’t want for some reason the key of the toolbar button you can go over and take all the button tolls form your toolbar tools collection ( this.ultraToolbarsManager1.Toolbars[0].Tools) and set the desired property by the index, but note that tear order is different than the toolbar UI, so the best way it so use the key of the tool.I hope this helps.Sincerely,DimiDeveloper Support EngineerInfragistics, Inc.
Thanks for your help, but I don't seem to have the SharedProps available through the intellisense.
When I paste in the code you suggested, obviously substituting in the real button name, I get an error saying 'Property access must assign to the property or use its value'.
When I key in the code rather than pasting it, I get as far as me.ultraToolBarsManager1.Toolbars[0].Tools["AllocationTransferToolKey"]. - and then there is no SharedProps option from Intellisense...
Do I need to import something in particular to be able to use this?
Hi, I have posted C# code and I see that you are using VB, right? If so, you can use directly in the code:me.ultraToolBarsManager1.Toolbars(0).Tools("AllocationTransferToolKey"). SharedProps.Enabled = true.SharedProps is not showed in the intelligence I think because of this reason.Can you please try that and let me know if is working for you.Sincerely,DimiDeveloper Support EngineerInfragistics, Inc.
Hi Dimi,
That certainly solved the problem with the intellisense and I get no errors in the code.
I think I'm doing something else wrong though because I get 'Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: Index' when I run the project and it hits that line of code and tries to disable the button.
I'll look into it a bit more.
Thanks for your help.
Hello , Are you sure that you are trying to access the tool bar and the tool after they was created, please check if the tool bar was generated first.Something like this:If Me.ultraToolbarsManager1.Toolbars.Count > 0 AndAlso Me.ultraToolbarsManager1.Toolbars(0).Tools.Count > 0 Then' put your code hereEnd IfI hope this helps.Sincerely,DimiDeveloper Support EngineerInfragistics, Inc.