Hi,
we want to be able to change the image of a popupmenutool at runtime:
switch (e.Tool.Key) { case "ButtonTool2":
PopupMenuTool popupMenuToolCaptionAlignmentVertical = ultraToolbarsManager1.Tools["PopupMenuTool1"] as PopupMenuTool; if (popupMenuToolCaptionAlignmentVertical != null) { //AppearanceData appearanceData = new AppearanceData(); //popupMenuToolCaptionAlignmentVertical.Tools[0].ResolveAppearance(ref appearanceData);
if (popupMenuToolCaptionAlignmentVertical.CustomizedImage != null) { popupMenuToolCaptionAlignmentVertical.CustomizedImage.Dispose(); popupMenuToolCaptionAlignmentVertical.CustomizedImage = null; }
popupMenuToolCaptionAlignmentVertical.CustomizedImage = Image.FromFile(...);
}
While changing of a PopupColorPickerTool works, the icon of the PopupMenutTool is not changing.
Michael
Hello ,
Appearance of ToolObjects are resolved by the following hierarchy
Get SharedProps , get AppearanceSmall is state of the tool is small
If the state is Large the appearance will try to get everything from AppearanceLarge and if there is any defaults which could be populate by AppearanceSmall they will be got.
If there is InstanceProps, then appearance from instance props get precedence over SharedProps from SharedProps
Again any defaults will be filled by the appearance with lower priority (i.e. from SharedProps - > SharedProps then SharedProps-> AppearanceSmall)
So I am not sure which exactly version you are using, but setting your image on SharedPropsAppearance should works. You should change your code to something like:
popupMenuToolCaptionAlignmentVertical.SharedProps.AppearancesSmall.Appearance.Image = Image.FromFile("..\\..\\Folder.jpg");
Please let me know if you have any further questions.