Hi all,
I have a usercontrol, in which there are several controls, one of which is of type "UltraToolbarsManager". There is a requirement in which I have to write a control enumeration code through which I have to find this toolbar manager in the controls collection of the usercontrol, recursively of course. First I thought that I would simply find my toolbar manager in the controls collection, but this was not the case. So I referred to the *.designer.vb to learn that the UltraToolbarsManager control goes inside the "ToolbarsManager" property of a "UltraWinToolbars.UltraToolbarsDockArea" control, hence not available in the controls collection. For which I'll have to check the "ToolbarsManager" property as:
.. 'c is type "Control". a lil snippet from a recursive function I wrote for enumerating control in a usercontrol If c.GetType() = GetType(Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea) Then
Dim x As Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea = CType(c, Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea) If x.ToolbarsManager IsNot Nothing AndAlso m_toolbar Is Nothing Then Dim o As Object = x.ToolbarsManager If o.GetType() = GetType(UltraToolbarsManager) Then m_toolbar = CType(o, UltraToolbarsManager) 'thats what we were here for
Exit For
End If End If
End If..
this works, only the problem is that the documentation says about ToolbarsManager that "This is an internal property and should never be set directly.". I'm not setting it, just getting it, is that ok? And if ToolbarsManager property is not recommended (intellisense also doesnt show this property), what else is there that I should use alternatively locate my ultratoolbars control.
Hope I made myself clear in this question.
thanks.
Hello jangroup,
Thank you for your response.
Since the UltraToolbarsManager is not a control in and of itself, it does not get added to the UserControl's Controls collection. You'll see the same behavior with any component that is put in the tray when you drag it onto the designer surface. You could use reflection to get access to it, but it would be much simpler to just add a property to your UserControl that provides access to the manager.
That's not exactly what I wanted to know. The modifiers can be changed, I can access the toolbar through the name of its variable as well, I can do whole sort of things with it. My question is about a unique requirement, where I have to "find" that control (as I described in detail in my first post), and to do that I have to enumerate the controls collection of my usercontol.
Thank you for contacting Infragistics.
When you first add the UltraToolbarsManager to the UserControl, the modifier for the member variable is "private" by default, which means it will not be visible outside the UserControl. You will need to change the modifier property of the UltraToolbarsManager in the designer to either internal or public depending on whether you need to access it from outside the assembly.