Ribbon Menu live preview

Ribbon for WPF Forum

Posted 7 years ago by rex hui
Version: 17.2.0661
Avatar

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.

Comments (9)

Answer - Posted 7 years ago by rex hui
Avatar

Never mind, just figured out there is the IsHighlighted property.

Thanks!

Posted 7 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

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.


Actipro Software Support

Posted 7 years ago by rex hui
Avatar

Thank you.

In my case, I have a SplitButton containing Menu of Buttons inside a Ribbon. The Parameter is of type CheckableCommandParameter. Any idea?

Posted 7 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

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.


Actipro Software Support

Posted 7 years ago by rex hui
Avatar
<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

Posted 7 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Oh, apologize... I forgot to confirm which controls support live preview.  Only ComboBox and galleries support that command-driven form of live preview.

[Modified 7 years ago]


Actipro Software Support

Posted 7 years ago by rex hui
Avatar

Yeah, that's what I thought so there is no easy way to do preview in Menu, right?

Posted 7 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Probably not with our built-in features unless you use a PopupGallery in your menu.  That would support it per above.


Actipro Software Support

Posted 7 years ago by rex hui
Avatar

Thanks, PopupGallery actually works well.

The latest build of this product (v24.1.2) was released 2 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.