Nested PopupButton Content wont show

Ribbon for WPF Forum

Posted 10 years ago by Clint David
Version: 14.1.0602
Avatar

Hi,

I am trying to build a control using the PopupButton and i want the PopupContent to be multilevel. Here is a sample code:

<controls:PopupButton Height="22" HorizontalAlignment="Left" Width="100" Margin="0,5,5,5" DisplayMode="Merged" IsRounded="False" StaysOpen="False">
<controls:PopupButton.PopupContent>
<ribbon:Menu>
<ribbon:Separator Label="Font Properties" />
<MenuItem Style="{StaticResource Test}" Header="Level 1">
<MenuItem Header="Level 2 (this is not showing)" />
</MenuItem>
</ribbon:Menu>
</controls:PopupButton.PopupContent>
</controls:PopupButton>

There are other requiremnts for this but i am stucked getting this part work.

Any suggestions? Thanks!

Comments (4)

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

Hi Clint,

That won't work since you need to use ribbon:Button, ribbon:PopupButton, ribbon:SplitButton, and ribbon:Separator controls in a ribbon:Menu instead of native WPF MenuItems.  If you switch to those controls instead, they will render like menu items.


Actipro Software Support

Posted 10 years ago by Clint David
Avatar

Yeah I tried that one already. My problem with that is you can only set the "Label" property which takes only a String object type. I need it to be a Content object because I need it dynamically change it to a value which is not always a String based on the selected value on the submenu.

How can i attach a screenshot of my requirement here?

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

Hi Clint,

That is correct, the ribbon menu items require a text string.  I would recommend you possibly bind their Label with a value converter that can convert your real object values to an appropriate string.

I don't think native MenuItems can be used in random popups.  They have to be hosted within a native Menu or ContextMenu directly to work properly.

You can add any other control though in the popup content, just be sure you do it outside of the ribbon:Menu.  Perhaps you could make a custom templated button to achieve the look you want and inject it that way.


Actipro Software Support

Posted 10 years ago by Clint David
Avatar

I suppose i'll just create a new template for my case and change my design a bit. i'll probably utilize the icon column for the dynamic part by writing a code that creates a bitmap from controls.

 

Thanks, glad to have this clarified. Time to move on :)

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

Add Comment

Please log in to a validated account to post comments.