
Does the ribbon menu provide live preview?
If not, how to add that? I couldn't find a way to get the current selected menu item.
Thanks.
Does the ribbon menu provide live preview?
If not, how to add that? I couldn't find a way to get the current selected menu item.
Thanks.
Never mind, just figured out there is the IsHighlighted property.
Thanks!
Hello,
Actually, live preview can be accomplished via the use of ribbon commands. In the documentation that comes with the product, please see the "Interaction with Value Controls" topic. That describes it.
Our main Document Editor demo also shows the use of live preview via the font family/size ComboBoxes, and the foreground/background popup galleries. Those are good examples to look at.
Thank you.
In my case, I have a SplitButton containing Menu of Buttons inside a Ribbon. The Parameter is of type CheckableCommandParameter. Any idea?
Hello,
I believe IValueCommandParameter is required to support our live preview features. If you also need checking, perhaps you could make an object that implements both IValueCommandParameter and ICheckableCommandParameter and use that instead.
<ribbon:Group Label="Edit" >
<ribbon:SplitButton Id="Edit" Label="Edit" ImageSourceLarge="/Resources/Images/Edit32.png" >
<ribbon:Menu>
<ribbon:Button Label="Menu item 1" Command="local:MainWindow.EditCommand">
<ribbon:Button.CommandParameter>
<ribbon:StringValueCommandParameter />
</ribbon:Button.CommandParameter>
</ribbon:Button>
<ribbon:Button Label="Menu item 2" Command="local:MainWindow.EditCommand">
<ribbon:Button.CommandParameter>
<ribbon:StringValueCommandParameter />
</ribbon:Button.CommandParameter>
</ribbon:Button>
</ribbon:Menu>
</ribbon:SplitButton>
</ribbon:Group>
private void OnEditCommandCanExecute(object sender, CanExecuteRoutedEventArgs e)
{
if (e != null)
{
StringValueCommandParameter sv = (StringValueCommandParameter)e.Parameter;
if (sv != null)
{
Debug.WriteLine($"OnEditCommandCanExecute sv={sv.Action}");
}
}
e.CanExecute = true;
e.Handled = true;
}
The Action is always Commit
Oh, apologize... I forgot to confirm which controls support live preview. Only ComboBox and galleries support that command-driven form of live preview.
[Modified 8 years ago]
Yeah, that's what I thought so there is no easy way to do preview in Menu, right?
Probably not with our built-in features unless you use a PopupGallery in your menu. That would support it per above.
Thanks, PopupGallery actually works well.
Please log in to a validated account to post comments.