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
1005
How to change a PopupMenuTool image at runtime
posted

How should I change a PopupMenuTool image at runtime?  I tried setting the CustomizedImage property and this seemed to work initially, but has now stopped working for some reason. :(

What I actually want to do is assign the icon for the currently selected menu item (from it's children), but at the moment I can't actually find a way to get this image from the child item either, which is a StateButtonTool, so I have been assigning the actual resource image used instead, but this is less flexible and harder to maintain.

Any help on either problem is appreciated.

Brian

Parents
No Data
Reply
  • 44743
    posted

    brian_h said:
    How should I change a PopupMenuTool image at runtime?  I tried setting the CustomizedImage property and this seemed to work initially, but has now stopped working for some reason. :(

    This might be a bug. I would recommend submitting the issue to the support group: http://es.infragistics.com/gethelp. As a workaround, you can set the Image on the appropriate Appearance... property on the InstanceProps of the tool.

    brian_h said:
    What I actually want to do is assign the icon for the currently selected menu item (from it's children), but at the moment I can't actually find a way to get this image from the child item either, which is a StateButtonTool, so I have been assigning the actual resource image used instead, but this is less flexible and harder to maintain.

    The best way to get the actual image used for an instance of a tool is to call one of the ResolveAppearance methods on it and get the Image from the resolved appearance:

    AppearanceData appearanceData = new AppearanceData();
    popupMenuTool.Tools[0].ResolveAppearance(ref appearanceData);
    Image image = appearanceData.Image as Image;

    if(image != null)
    {
        // ...
    }

     

Children