ribboncheckbox images

Aug 27, 2009 at 10:02 PM

I have a RibbonMenuItems collection, to which I add some RibbonCheckBox instances. They work OK, but the left side bar, where small images should be are blank. The checkbox and label appear to the right of this shaded sidebar.

My ribbon xml looks like so:

 

<r:RibbonDropDownButton x:Name="Settings2DropDownButton">
<r:RibbonDropDownButton.Command>
<r:RibbonCommand LabelTitle="Settings" CanExecute="RibbonCommand_CanExecute" LargeImageSource="{StaticResource DesignAFormOutlook32}"/>
</r:RibbonDropDownButton.Command>
<r:RibbonDropDownButton.Items>
<r:RibbonMenuItem>
<r:RibbonMenuItem.Command>
<r:RibbonCommand LabelTitle="MenuItem Label"
SmallImageSource="{StaticResource ControlTabControl16}"
CanExecute="RibbonCommand_CanExecute" />
</r:RibbonMenuItem.Command>
</r:RibbonMenuItem>
<r:RibbonCheckBox>
<r:RibbonCheckBox.Command>
<r:RibbonCommand LabelTitle="Checkbox Label"
SmallImageSource="{StaticResource ControlTabControl16}"
CanExecute="RibbonCommand_CanExecute" />
</r:RibbonCheckBox.Command>
</r:RibbonCheckBox>
</r:RibbonDropDownButton.Items>
</r:RibbonDropDownButton>

See that I'm trying to set the small icon image on the checkbox, just like for a standard menu item. It doesn't work for the checkbox.

 

The look I'm after, fwiw, can be seen in Word or Excel's  "Switch Windows" button in the View group.

Any thoughts?

Thanks.

Coordinator
Aug 28, 2009 at 8:46 PM

Hi rogerr,

The behavior you're looking for is actually implemented in the customize menu for the RibbonQuickAccessToolbar, so you should be able to look at the template for that control and apply the same styles to the template of your RibbonDropDownButton's drop-down menu.  You can view the templates for RibbonQuickAccessToolbar by using .NET Reflector with the BamlViewer add-on.

Thanks!
Samantha

Aug 30, 2009 at 12:16 AM
Actually, it looks like it is even easier.
Just add a normal RibbonMenuItem with the IsCheckable property set to
true and bind its IsChecked property to whatever.
This gives the look I'm after.

How'd I figure that out?

By looking at the code that creates the customization menu for the QAT
in reflector.

Which makes me wonder - why not just make the RibbonControlsLibrary
source code available on codeplex?

Thanks for the tip on the baml viewer addin. That will certainly come in handy.


On Fri, Aug 28, 2009 at 1:46 PM, samanthamsft<notifications@codeplex.com> wrote:
> From: samanthamsft
>
> Hi rogerr,
>
> The behavior you're looking for is actually implemented in the customize
> menu for the RibbonQuickAccessToolbar, so you should be able to look at the
> template for that control and apply the same styles to the template of your
> RibbonDropDownButton's drop-down menu.  You can view the templates for
> RibbonQuickAccessToolbar by using .NET Reflector with the BamlViewer add-on.
>
> Thanks!
> Samantha
>
> Read the full discussion online.
>
> To add a post to this discussion, reply to this email
> ([email removed])
>
> To start a new discussion for this project, email
> [email removed]
>
> You are receiving this email because you subscribed to this discussion on
> CodePlex. You can unsubscribe on codePlex.com.
>
> Please note: Images and attachments will be removed from emails. Any posts
> to this discussion will also be available online at codeplex.com