我试图重新创建显示在"现代"左边的菜单栏。 Windows 10应用程序,例如天气,地图和搜索应用程序。
目前我有一个菜单捕捉到顶部网格,然后在其中我有StackPanels包含两个标签 - 一个带有Segoe Assets字体的标签用于图标,然后是一个真正的标签,例如"设置& #34;
这是我当前的XML:
<Menu x:Name="mnuLeft" Style="{StaticResource leftMenu}" Background="#FF2B2B2B" Foreground="White" Margin="0,48,349.667,0" Focusable="True" Padding="0" Width="Auto" >
<Menu.ItemsPanel>
<ItemsPanelTemplate>
<DockPanel HorizontalAlignment="Stretch" VerticalAlignment="Stretch" LastChildFill="False"/>
</ItemsPanelTemplate>
</Menu.ItemsPanel>
<StackPanel Orientation="Horizontal" DockPanel.Dock="Top" Width="191" VerticalAlignment="Top" HorizontalAlignment="Left">
<Label x:Name="label9" Content="" HorizontalAlignment="Left" Height="48" Width="48" FontFamily="Segoe MDL2 Assets" FontSize="18.667" Foreground="White" HorizontalContentAlignment="Center" VerticalContentAlignment="Center"/>
<Label x:Name="label10" Content="Options" Margin="0,-0.667,0,0.666" HorizontalAlignment="Left" FontSize="16" Foreground="White" Height="48" VerticalContentAlignment="Center"/>
</StackPanel>
<StackPanel Orientation="Horizontal" DockPanel.Dock="Bottom" Width="191" VerticalAlignment="Bottom" HorizontalAlignment="Left">
<Label x:Name="label7" Content="" HorizontalAlignment="Left" Height="48" Width="47" FontFamily="Segoe MDL2 Assets" FontSize="18.667" Foreground="White" VerticalAlignment="Top" HorizontalContentAlignment="Center" VerticalContentAlignment="Center"/>
<Label x:Name="label8" Content="Status" Margin="0,-0.667,0,0.666" Width="125.659" HorizontalAlignment="Left" FontSize="16" Foreground="White" Height="48" VerticalContentAlignment="Center"/>
</StackPanel>
</Menu>
基本上我想要的是StackPanel包含停靠在菜单底部的选项,然后状态停靠在顶部(稍后会添加更多堆栈面板)。但是,当VerticalAlign设置为Stretch时,它们位于居中位置,而当VerticalAlign设置为top时,它们都位于顶部。
我尝试了多次设置迭代,包括使用我希望避免的固定边距值,因为我更喜欢用户能够缩放窗口。