2013-10-30 97 views
-1

我正在使用WPF桌面应用程序。 MainWindow是一个最大化的窗口,其菜单项很少。我想在窗口中心的组框中显示一些控件。该组框包含取决于所点击的菜单项的控件。所以groupbox的大小不应该是静态的。这可能吗?WPF显示/隐藏一组控件

感谢

回答

0

尝试定义这样

<Window x:Class="WpfApplication1.MainWindow" 
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
Title="MainWindow" Height="350" Width="525" WindowState="Maximized"> 
<Grid> 
    <Grid.RowDefinitions> 
     <RowDefinition Height="auto"/> 
     <RowDefinition Height="*" /> 
    </Grid.RowDefinitions> 
    <GroupBox Grid.Row="0" HorizontalAlignment="Center" VerticalAlignment="Center"> 
     <StackPanel> 
      <Button Content="Click" Height="30" Width="160"/> 
      <Button Content="Click" Height="30" Width="160"/> 
      <!--<Button Content="Click" Height="30" Width="160"/>--> 
     </StackPanel> 
    </GroupBox>   
    <Grid Grid.Row="1"> 
     <TextBlock FontSize="26" FontWeight="Bold" HorizontalAlignment="Center" VerticalAlignment="Center" Text="MainUserWork Panel"/> 
    </Grid> 
</Grid> 

+0

对不起,我没去上班我想要你的XAML。 – user2934956

+0

显示你的代码,你到底在找什么? –