-
August 8th, 2010, 12:47 PM
#1
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.
-
September 13th, 2010, 05:16 PM
#2
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|