我是XAML新手,所以我不知道该怎么做。 我的设计应该在顶部有一个菜单栏(宽度为100%),接着是一个带有左侧按钮和右侧(100%宽度)按钮的其他酒吧,之后它应该是左边的侧边栏(大约100像素),其余的应该是“内容”,所以我想我的控件(按钮,列表视图,网格,lkabWPF gui xaml设计
与我的代码看起来不坏,但侧边栏应该在包含两个dockpanels。
http://oi66.tinypic.com/xf5dhw.jpg
<Window Background="#f5f5f5" Width="1280" Height="800" x:Class="WpfApplication3.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:WpfApplication3"
mc:Ignorable="d"
Title="primoxx">
<Grid>
<DockPanel LastChildFill="False" Grid.Row="0" HorizontalAlignment="Stretch" VerticalAlignment="Top">
<DockPanel DockPanel.Dock="Top">
<Menu DockPanel.Dock="Top">
<MenuItem Header="_Datei" />
<MenuItem Header="_Bearbeiten" />
<MenuItem Header="_Verwaltung" />
<MenuItem Header="_Vorlagen" />
<MenuItem Header="_Gestaltung" />
<MenuItem Header="_Extras" />
<MenuItem Header="_Hilfe" />
</Menu>
</DockPanel>
<DockPanel Background="White" LastChildFill="False" DockPanel.Dock="Top">
<Button Height="30px">My Button</Button>
</DockPanel>
</DockPanel>
<DockPanel Grid.Row="1" VerticalAlignment="Top">
<DockPanel DockPanel.Dock="Left">
<StackPanel>
<Button Style="{StaticResource subMenuButton}">Hello</Button>
</StackPanel>
</DockPanel>
<DockPanel DockPanel.Dock="Right">
</DockPanel>
</DockPanel>
</Grid>
您可能需要使用'Grid'与'Rows'和'Columns'而不是'DockPanel' –
设置'Grid.Row =“1”'除非你真的在网格上定义了一些行,否则不会为你做任何事情。 –