Reputation: 1484
I am quite new to WPF and this might be a trivial question. What I want is to have the main menu with e.g. File, Edit, View etc, and to have a couple of controls in the window e.g few TextBoxes, Buttons, ListBoxes etc. How should I structure my XAML?
Upvotes: 1
Views: 1356
Reputation: 717
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition/>
</Grid.RowDefinitions>
<!--
MENU
-->
<Menu>
<MenuItem Header="File"/>
<MenuItem Header="Edit"/>
<MenuItem Header="Help"/>
</Menu>
<!--
APP CONTENT
-->
<Grid Grid.Row="1" Margin="20">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<TextBox Text="Enter text here" Height="20"/>
<Button Content="Click me" Height="20" Grid.Column="1"/>
</Grid>
</Grid>
See http://wpftutorial.net/GridLayout.html
Upvotes: 3