对于Main,我替换了
stackpanel
添加网格布局
VerticalAlignment="Stretch"
.
<Grid x:Name="stackPanelMain" Grid.Row="0" Grid.Column="0" VerticalAlignment="Stretch" >
<Grid Background="#FF45474A" VerticalAlignment="Stretch" >
<Grid.RowDefinitions>
<RowDefinition Height="400*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="400" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<StackPanel x:Name="stackPanelLeft" Grid.Row="0" Grid.Column="0" Background="#FF393939" Margin="0,0,20,0">
<!-- Left content -->
<Label x:Name="labelProjects" Content="New project" Margin="0,20,0,0" FontSize="16" Foreground="#FFBABAA8" FontWeight="Bold"/>
<Label x:Name="labelNewProjectStep01" Content="Project information" Margin="0,0,0,0" FontSize="14" Foreground="#FFBABAA8" FontStyle="Italic" />
<Label x:Name="labelNewProjectStep02" Content="Automated tasks" Margin="0,0,0,0" FontSize="14" Foreground="#FFBABAA8" />
<Label x:Name="labelNewProjectStep03" Content="Search" Margin="0,0,0,0" FontSize="14" Foreground="#FFBABAA8" />
<!-- //Left content -->
</StackPanel>
<StackPanel x:Name="stackPanelRight" Grid.Row="0" Grid.Column="1">
<!-- Right content -->
<DockPanel x:Name="dockPanelMain" LastChildFill="False">
<!--<local:NewProjectStep01ProjectInformationUserControl x:Name="newProjectStep01ProjectInformationUserControl" Panel.ZIndex="0" />
<local:NewProjectStep02AutomatedTasksUserControl x:Name="NewProjectStep02AutomatedTasksUserControl" Panel.ZIndex="1" />
<local:NewProjectStep03SearchUserControl x:Name="NewProjectStep03SearchUserControl" Panel.ZIndex="2" />-->
</DockPanel>
<!-- //Right content -->
</StackPanel>
</Grid>
</Grid>