Question

Ribbon Menu live preview

Posted 10 months ago by Avatar rex hui

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)

Posted 10 months ago by rex hui

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

Thanks!

Posted 10 months ago by Actipro Software Support - Cleveland, OH, USA

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 10 months ago by rex hui

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 10 months ago by Actipro Software Support - Cleveland, OH, USA

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 10 months ago by rex hui
<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 10 months ago by Actipro Software Support - Cleveland, OH, USA

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

[Modified 10 months ago]


Actipro Software Support
Posted 10 months ago by rex hui

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

Posted 10 months ago by Actipro Software Support - Cleveland, OH, USA

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 10 months ago by rex hui

Thanks, PopupGallery actually works well.

Information The latest build of this product (2018.1 build 0671) was released 1 month ago, which was after the last post in this thread.

Add a Comment

Please log in to a validated account to post comments.