Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
485
Enabling / Diabling tools
posted

Hi,

we're creating tools for our ribbon dynamically using spring (www.springframework.net). The tools get registered on the toolbar manager right at creation and are added to groups by its keys.

Layout (image, size, caption, etc.) of the tools is provided while construction using decorators which implement functionality to set appropriate appearance properties, e.g. something like this

        /// <summary>
        /// Decorates a tool
        /// </summary>
        /// <param name="tool">tool to decorate</param>
        public void Decorate(ITool tool)
        {
            ((ToolBase)tool).SharedProps.Caption = this.caption;
        }

Some of the tools are disabled upon creation using this technique:

        /// <summary>
        /// Decorates a tool
        /// </summary>
        /// <param name="tool">tool to decorate</param>
        public void Decorate(ITool tool)
        {
            ((ToolBase) tool).SharedProps.Enabled = this.enabled;
        }

Fine. This works as expected. Now, sometime the we decide to activate the tools again at runtime, e.g. if in a list a item was selected. In our situation this means, that we activate all tools on a RibbonTab. We inherited from the RibbonTab and call the following function:

        private void OnEnabledChanged(bool newValue)
        {
            this.enabled = newValue;
            foreach (RibbonGroup  group in base.Groups)
            {
                foreach (var tool in group.Tools)
                {
                    tool.SharedProps.Enabled = this.enabled;
                }
            }
        }

This activates all tools as expected. But, the first time I now click on a PopupControlContainerTool the tool gets deactivated and can not be accessed anymore until I again activate it (e.g. by selecting another item from the list as mentioned above).

 

Regards,

Michael

Parents
  • 6158
    Offline posted

    Michael,

    Using the code you provided as a reference, I attempted to reproduce the behavior as described. Unfortunately, I could not reproduce the behavior of the PopupControlContainerTool becoming disabled when you click on it. Therefore, it seems the issue is either related to the version of the Infragistics being used, or processing within the application itself.

    I have attached my sample application so you can reference it in hopes of finding a difference in our processing. If you happen to find the difference, and need help determining if its an issue within your application or a problem within our controls, please let me know. Additionally, if you have any other questions or information, feel free to reply.

    Thanks,
    Chris

    WindowsApplication7.zip
Reply Children