Menu and Content not working.
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: Menu and Content not working.

  1. #1
    Join Date
    Dec 2005
    Posts
    114

    Menu and Content not working.

    I'm new to WPF. I've just been trying to put a menu bar and a grid object in a window, but I always get the exception that I am trying to set a content property more than once. I can't figure out how to put a menu along with other elements in the window.

    Code:
    <Window x:Class="WpfApplication1.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="Eliptical Button">
       
            <Menu IsMainMenu="True">
                <MenuItem Header="File">
                    <MenuItem Header="New"/>
                    <Separator/>
                    <MenuItem Header="Open"/>
                    <MenuItem Header="Save"/>
                    <Separator/>
                    <MenuItem Header="Save As..."/>
                    <Separator/>
                    <MenuItem Header="Exit"/>
                </MenuItem>
                <MenuItem Header="Edit"/>
            </Menu>
        
        <Grid>
            <Button/>
        </Grid>
    </Window>
    Can someone please help me to get this right? Thanks.

  2. #2
    Join Date
    Sep 2010
    Posts
    3

    Re: Menu and Content not working.

    you must put the menu and the grid with the button (or just the button) in a single main grid so the main window will have only one child

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center