Menu Bar in WPF

Amit Patel 126 Reputation points

I want to create a Menu bar in WFP Form, so that I dont write the same code on every page, How can I do that?

Windows Presentation Foundation
Windows Presentation Foundation
A part of the .NET Framework that provides a unified programming model for building line-of-business desktop applications on Windows.
2,635 questions
A language based on Extensible Markup Language (XML) that enables developers to specify a hierarchy of objects with a set of properties and logic.
744 questions
0 comments No comments
{count} votes

Accepted answer
  1. DaisyTian-1203 11,611 Reputation points

    You can create the Meun Bar in a UserControl, then use it the page which need the Meun Bar.
    For example, you can create a UserControl named MyMenuBar like below:

            <Menu DockPanel.Dock="Top">  
                <MenuItem Header="_File">  
                    <MenuItem Header="_Open"/>  
                    <MenuItem Header="_Close"/>  
                    <MenuItem Header="_Save"/>  

    Then you can use it in Window1 like below:
    The Window1 will show the Meun Bar. Did I misunderstand your question? If I did, could you give me more description of your question for me to anlyze.

    If the response is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Amit Patel 126 Reputation points

    Thank You @DaisyTian-MSFT , you have understood my query perfectly and has provided the perfect answer.

    0 comments No comments