Posted 16 years ago by Peter Idestam-Almquist
Avatar
Hello,

I wonder how to display a popup menu using a PopupButton.

I am trying this way:


<Controls1:PopupButton Content="Control" Width="75" Margin="5 0 0 0">
                            <Controls1:PopupButton.PopupContent>
                                <Menu Width="75" IsMainMenu="False" >
                                    <Menu.ItemsPanel>
                                        <ItemsPanelTemplate>
                                            <VirtualizingStackPanel Orientation="Vertical" />
                                        </ItemsPanelTemplate>
                                    </Menu.ItemsPanel>
                                <MenuItem x:Name="startMenuItem" Header="Start" IsEnabled="{Binding Path=CanStart}" Click="startMenuItem_Click" >
                                </MenuItem>
                                
                            </Menu>
                            </Controls1:PopupButton.PopupContent>
                        </Controls1:PopupButton>

However, the menu background is incorrect.

Is there any better way to do the job?

Thank you!

Comments (2)

Posted 16 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Peter,

There is a QuickStart that demosrates this in the Sample Browser, under Shared Library\PopupButton. But to answer your question, you would need to use the PopupMenu property, not the PopupContent. Also, you would need to use a ContextMenu object, not a Menu object. Something like this:
<shared:PopupButton ...>
    <shared:PopupButton.PopupMenu>
        <ContextMenu>
            <MenuItem .... />
        </ContextMenu>
    </shared:PopupButton.PopupMenu>
</shared:PopupButton>


Actipro Software Support

Posted 16 years ago by Peter Idestam-Almquist
Avatar
Thank you! It seems I missed this QuickStart...
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.