context menu text is cut off

Ribbon for WPF Forum

Posted 15 years ago by sbarry
Version: 9.1.0505
Avatar
Hi,

We are using your ContextMenu class with Button as the menu item object. Each button has its Command property set to a RibbonCommand. For some menu items, the label is dynamic and sensitive to the current selection. We change the label in the CanExecute handler for the menu item. The problem we are seeing is that the Button whose command's label property we are changing is not updating its layout, causing the text to get cut off. We are trying to force the context menu to update its layout, but no luck. Here is the CanExecute event handler:

        private void CanExecuteEventHandler(object sender, CanExecuteRoutedEventArgs e)
        {
            RibbonCommand command = e.Command as RibbonCommand;
            if (command != null)
            {
                if (e.CanExecute == false)
                {
                    command.Label = PresenterStrings.SetAsDefault;
                }
                else
                {
                    if (Flowchart.Selection.Shapes.Count() == 1)
                    {
                          command.Label = GetDynamicLabel();
                         _contextMenu.InvalidateMeasure();                        
                    }
                }
            }
        }
Here is the context menu xaml snippet:

 <ribbon:Menu x:Name="_contextMenu">
          <ribbon:PopupButton Label="Format">
          <ribbon:Menu x:Name="_formatMenu">
            <ribbon:Button Command="{StaticResource SaveStyleAsCommand}"/>
            <ribbon:Button Command="{StaticResource SetAsDefaultStyleCommand}" x:Name="_formatMenuItem" />
          </ribbon:Menu>
        </ribbon:PopupButton>
</ribbon:Menu>
Any ideas? Thanks!

Sean

Comments (1)

Posted 15 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Sean,

Can you package up a simple sample project that shows the issue and email it to our support address? Thanks!


Actipro Software Support

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

Add Comment

Please log in to a validated account to post comments.