2017-04-20 23 views
0

我正在處理某個項目,並且在伸展窗戶時遇到問題。當我做最後的元素在堆疊面板disapears。我有一個主StackPanel裏面有更多的Grids和StackPanels。 我會發布關於我的問題的5秒視頻,如果有人需要,我也可以發佈代碼。當我伸展我的窗戶時,底部元素消失

------VIDEO------

這裏是我的代碼:

<Window x:Class="BookReader2017.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:BookReader2017" 
    mc:Ignorable="d" 
    Title="MainWindow" Height="800" Width="525" 
    WindowStartupLocation = "CenterScreen"> 


<Border Padding="10" Background="#2d2d30" Margin="0,0,0,0"> 


    <StackPanel Name="StackMenu"> 


      <Grid> 

       <Grid.ColumnDefinitions> 
        <ColumnDefinition MinWidth="110"/> 
        <ColumnDefinition Width="10"/> 
        <ColumnDefinition Width="*"/> 
        <ColumnDefinition Width="*"/> 
        <ColumnDefinition Width="*"/> 
        <ColumnDefinition Width="*"/> 
        <ColumnDefinition Width="3*"/> 
        <ColumnDefinition Width="*"/> 
       </Grid.ColumnDefinitions> 

       <Image Width="100" HorizontalAlignment="Left" Source="BrImages/logo.png" Grid.Column="0" /> 

       <Border Grid.Column="2" > 
        <Border.Effect> 
         <DropShadowEffect BlurRadius="25"/> 
        </Border.Effect> 

        <Button x:Name="Button1" BorderBrush="#3db1ff" BorderThickness="0 0 0 3" Margin="2 2 2 2" Background="#007acc" Foreground="white"> 
         <StackPanel> 
          <Image Source="BrImages/open.png" Width="50" Height="30"/> 
          <TextBlock Text="Open" HorizontalAlignment="Center" /> 
         </StackPanel> 
        </Button> 

       </Border> 

       <Border Grid.Column="3"> 
        <Border.Effect> 
         <DropShadowEffect BlurRadius="25"/> 
        </Border.Effect> 
        <Button x:Name="Button2" BorderBrush="#3db1ff" BorderThickness="0 0 0 3" Margin="2 2 2 2" Background="#007acc" Foreground="white"> 
         <StackPanel> 
          <Image Source="BrImages/settings.png" Width="50" Height="30"/> 
          <TextBlock Text="Settings" HorizontalAlignment="Center" /> 
         </StackPanel> 
        </Button> 
       </Border> 

       <Border Grid.Column="4"> 
        <Border.Effect> 
         <DropShadowEffect BlurRadius="25"/> 
        </Border.Effect> 
        <Button x:Name="Button3" Click="Button3_Click" BorderBrush="#3db1ff" BorderThickness="0 0 0 3" Margin="2 2 2 2" Background="#007acc" Foreground="white"> 
         <StackPanel> 
          <Image Source="BrImages/fullscreen.png" Width="50" Height="30"/> 
          <TextBlock Text="Fullscreen" HorizontalAlignment="Center" /> 
         </StackPanel> 
        </Button> 
       </Border> 

       <Border Grid.Column="5"> 
        <Border.Effect> 
         <DropShadowEffect BlurRadius="25"/> 
        </Border.Effect> 
        <Button x:Name="Button4" Click="Button4_Click" BorderBrush="#3db1ff" BorderThickness="0 0 0 3" Margin="2 2 2 2" Grid.Column="4" Background="#007acc" Foreground="white"> 
         <StackPanel> 
          <Image Source="BrImages/about.png" Width="50" Height="30"/> 
          <TextBlock Text="About" HorizontalAlignment="Center" /> 
         </StackPanel> 
        </Button> 
       </Border> 

       <Border Grid.Column="7"> 
        <Border.Effect> 
         <DropShadowEffect BlurRadius="25"/> 
        </Border.Effect> 
        <Button x:Name="Button5" BorderBrush="#ff95b2" BorderThickness="0 0 0 3" Margin="2 2 2 2" Background="#b81d47" Foreground="white"> 
         <StackPanel> 
          <Image Source="BrImages/exit.png" Width="50" Height="30"/> 
          <TextBlock Text="Exit" HorizontalAlignment="Center" /> 
         </StackPanel> 
        </Button> 
       </Border> 


      </Grid> 

      <Separator Background="#1e1e1e" Margin="0,10,0,10"/> 


      <FlowDocumentReader Height="Auto" Margin="0 0 0 0" Foreground="white" Background="#007acc"> 
       <FlowDocument Background="#1e1e1e"> 

       </FlowDocument> 
      </FlowDocumentReader> 

      <TextBlock Text="BookReader 2017" TextAlignment="Center"/> 

     </StackPanel> 

</Border> 

+2

請您提供編碼? – Luke

+0

當然每個想要幫助你的人都需要代碼 –

+0

添加代碼,對不起:) –

回答

0

我想我想通了。我刪除了主要的StackPanel並將其全部放入一個DockPanel,然後我停靠了網格。我想現在這是一個很好的解決方案。

相關問題