Hi all
Got a slight issue with settng a ToggleButtonTool.LargeImage programmatically. The image is constantly showing small. I have noticed in the de-bugger that the tool.SizingMode has a value of "ImageAndTextNormal" which may well have something to do with it - but I'm stuffed if I can find how to change it. Any help appreciated - routine code below - the bit in Bold is how I'm attempting to set the image of the ToggleButtonTool.
Cheers
Andy
Here's the code:
public void AddCustomerButton(Guid guid, string buttonLabel)
{
foreach (RibbonTabItem l_tab in this.TheRibbon.Tabs)
if (l_tab.Name == ICERibbonTabs.CustomersTab.ToString())
foreach (RibbonGroup l_group in l_tab.RibbonGroups)
if (l_group.Name == ICERibbonGroup.OpenCustomersGroup.ToString())
ToggleButtonTool tool = new ToggleButtonTool();
tool.LargeImage = this._presenter.GetImage(Images32By32.customer);
tool.Name = "anythingfornow";
tool.Caption = buttonLabel;
l_group.Visibility = Visibility.Visible;
l_group.Items.Add(tool);
}
The default RibbonGroup.MaximumSize attached property value for ToggleButton (and the other buttons) is ImageAndTextNormal. You can set that (i.e. RibbonGroup.SetMaximumSize) to ImageAndTextLarge. Note, if the ribbon doesn't have enough room and a tool's MinimumSize is set to ImageOnly or ImageAndTextNormal then the tool could be reduced to the smaller size. If you didn't want that and therefore wanted to have the ribbongroups scroll then you could set the MinimumSize as well.
Thanks Andrew
I fixed it with this (RIbbonGroup doesn't have a SetMaximumSize method):
buttonTool.SetValue(RibbonGroup.MaximumSizeProperty,RibbonToolSizingMode.ImageAndTextLarge);
cheers