2013-10-30 94 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

顯示你的代碼,你到底在找什麼? –