2016-05-16 51 views
1
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"> 
    <Grid.ColumnDefinitions> 
     <ColumnDefinition Width="300" /> 
     <ColumnDefinition Width="*" /> 
    </Grid.ColumnDefinitions> 
    <Rectangle Fill="#8686EA" Grid.Column="0" /> 
    <Rectangle Fill="#FFFFE1" Grid.Column="1" /> 
    <TextBlock x:Name="NickNameBlock" HorizontalAlignment="Left" Margin="10,22,0,0" TextWrapping="Wrap" Text="Nickname" VerticalAlignment="Top"/> 
    <TextBox x:Name="NickName" HorizontalAlignment="Left" Margin="84,10,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="109"/> 
    <TextBlock x:Name="ChannelBlock" HorizontalAlignment="Left" Margin="10,59,0,0" TextWrapping="Wrap" Text="Channel" VerticalAlignment="Top"/> 
    <TextBox x:Name="Channel" HorizontalAlignment="Left" Margin="84,47,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="109"/> 
    <Button x:Name="JoinButton" Content="Join" HorizontalAlignment="Left" Margin="198,47,0,0" VerticalAlignment="Top"/> 
    <Grid Grid.Column="1"> 
     <Grid.ColumnDefinitions> 
      <ColumnDefinition Width="630" /> 
      <ColumnDefinition Width="200" /> 
     </Grid.ColumnDefinitions> 
     <Rectangle Fill="white" Stroke="Black" StrokeThickness="0" Grid.Column="0" Margin="10,27,0,100" /> 
     <!--<Rectangle Fill="white" Stroke="Black" StrokeThickness="1" Grid.Column="1" Margin="6,10,71,196" />--> 
     <Grid Grid.Column="1" Margin="0,0,0,196"> 
      <Grid.RowDefinitions> 
       <RowDefinition Height="40"/> 
       <RowDefinition Height="30"/> 
       <RowDefinition Height="*"/> 
      </Grid.RowDefinitions> 
      <Rectangle Fill="#8686EA" Stroke="Black" StrokeThickness="0" Grid.Row="0" Margin="10,0,0,0" /> 
      <Rectangle Fill="#CCCCFF" Stroke="Black" StrokeThickness="0" Grid.Row="1" Margin="10,0,0,-5" RenderTransformOrigin="0.505,0.719" Grid.RowSpan="2" /> 
      <ListBox x:Name="listBox" Grid.Row="2" Margin="10,10,0,0" VerticalAlignment="Top" VerticalContentAlignment="Stretch" ScrollViewer.VerticalScrollBarVisibility="Visible"> 
       <ListBox.Items> 
        <ListBoxItem Content="Tewl"/> 
        <ListBoxItem Content="Ryu"/> 
        <ListBoxItem Content="Clint"/> 
        <ListBoxItem Content="Bak3r"/> 
        <ListBoxItem Content="sm0kex"/> 
        <ListBoxItem Content="Jack"/> 
        <ListBoxItem Content="Bam"/> 
        <ListBoxItem Content="Jay"/> 
        <ListBoxItem Content="Tewl"/> 
        <ListBoxItem Content="Ryu"/> 
        <ListBoxItem Content="Clint"/> 
        <ListBoxItem Content="Bak3r"/> 
        <ListBoxItem Content="sm0kex"/> 
        <ListBoxItem Content="Jack"/> 
        <ListBoxItem Content="Bam"/> 
        <ListBoxItem Content="Jay"/> 
        <ListBoxItem Content="Tewl"/> 
        <ListBoxItem Content="Ryu"/> 
        <ListBoxItem Content="Clint"/> 
        <ListBoxItem Content="Bak3r"/> 
        <ListBoxItem Content="sm0kex"/> 
        <ListBoxItem Content="Jack"/> 
        <ListBoxItem Content="Bam"/> 
        <ListBoxItem Content="Jay"/> 
       </ListBox.Items> 
      </ListBox> 
     </Grid> 
    </Grid> 
</Grid> 

updated listbox in full mode updated nicklist resized still wont expand listbox列表框網格不會調整

這是reupdated克里斯W.這有整個code..my問題必須高於我真的很討厭寬/高/利潤率..

+1

刪除您的ListBox上的硬件高度和負邊距,然後在最後一個RowDefinition上將「auto」更改爲「*」。 –

+0

@Chris W.謝謝你的支持......我做了修改後,你修改了自上次發佈後修改...我仍然無法獲得完整的列表框屏幕,當窗口沒有最大化時[代碼] –

+0

Set VerticalContentAlignment = Stretch/VerticalAlignment = Stretch,如果不這樣做,那麼你的佈局結構中會有更高的衝突。 –

回答

0

因此,您的利潤率和行走數量以及不必要的混亂會讓您在將來更加頭痛。如果你不介意我只是繼續前進,重新寫下你在那裏所做的一切,這樣它會響應你做的任何調整大小和事情。請參閱下面的更改,其中包括您的答案。如果是我,我會做更多這樣的事情;

<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"> 
    <Grid.ColumnDefinitions> 
     <ColumnDefinition Width="300" /> 
     <ColumnDefinition Width="*" /> 
     <ColumnDefinition MinWidth="200" Width="Auto"/> 
    </Grid.ColumnDefinitions> 

    <!-- Left Pane --> 
    <Grid VerticalAlignment="Top" Margin="10"> 
     <Grid.RowDefinitions> 
      <RowDefinition/> 
      <RowDefinition/> 
     </Grid.RowDefinitions> 
     <Grid.ColumnDefinitions> 
      <ColumnDefinition Width="Auto"/> 
      <ColumnDefinition Width="*"/> 
      <ColumnDefinition Width="Auto"/> 
     </Grid.ColumnDefinitions> 
     <Grid.Resources> 
      <Style TargetType="TextBox"> 
       <Setter Property="MinHeight" Value="26"/> 
       <Setter Property="Margin" Value="5"/> 
      </Style> 
      <Style TargetType="TextBlock"> 
       <Setter Property="FontWeight" Value="SemiBold"/> 
       <Setter Property="VerticalAlignment" Value="Center"/> 
       <Setter Property="HorizontalAlignment" Value="Right"/> 
      </Style> 
     </Grid.Resources> 

     <!-- These didn't seem to have a purpose, so commenting out for now. 
     <Rectangle Fill="#8686EA" Grid.Column="0" /> 
     <Rectangle Fill="#FFFFE1" Grid.Column="1" /> 
     --> 

     <TextBlock x:Name="NickNameBlock" Text="Nickname"/> 
     <TextBox Grid.Column="1" x:Name="NickName" 
       TextWrapping="Wrap" Text=""/> 

     <TextBlock Grid.Row="1" x:Name="ChannelBlock" Text="Channel" /> 
     <TextBox Grid.Row="1" Grid.Column="1" x:Name="Channel" 
       TextWrapping="Wrap" Text=""/> 

     <Button Grid.Row="1" Grid.Column="2" x:Name="JoinButton" Content="Join" 
       MinWidth="50" Margin="0,5"/> 

    </Grid> 
    <!-- End Left Pane --> 

    <!-- Center Pane --> 
    <Rectangle Grid.Column="1" Fill="white"/> 
    <!-- End Center Pane --> 

    <!-- Right Pane --> 
    <Grid Grid.Column="2" Background="#CCCCFF"> 
     <Grid.RowDefinitions> 
      <RowDefinition Height="40"/> 
      <RowDefinition Height="40"/> 
      <RowDefinition Height="*"/> 
     </Grid.RowDefinitions> 
     <Rectangle Fill="#8686EA"/> 

     <ListBox x:Name="listBox" Grid.Row="2" 
       ScrollViewer.VerticalScrollBarVisibility="Visible"> 
      <ListBox.Items> 
       <ListBoxItem Content="Tewl"/> 
       <ListBoxItem Content="Ryu"/> 
       <ListBoxItem Content="Clint"/> 
       <ListBoxItem Content="Bak3r"/> 
       <ListBoxItem Content="sm0kex"/> 
       <ListBoxItem Content="Jack"/> 
       <ListBoxItem Content="Bam"/> 
       <ListBoxItem Content="Jay"/> 
       <ListBoxItem Content="Tewl"/> 
       <ListBoxItem Content="Ryu"/> 
       <ListBoxItem Content="Clint"/> 
       <ListBoxItem Content="Bak3r"/> 
       <ListBoxItem Content="sm0kex"/> 
       <ListBoxItem Content="Jack"/> 
       <ListBoxItem Content="Bam"/> 
       <ListBoxItem Content="Jay"/> 
       <ListBoxItem Content="Tewl"/> 
       <ListBoxItem Content="Ryu"/> 
       <ListBoxItem Content="Clint"/> 
       <ListBoxItem Content="Bak3r"/> 
       <ListBoxItem Content="sm0kex"/> 
       <ListBoxItem Content="Jack"/> 
       <ListBoxItem Content="Bam"/> 
       <ListBoxItem Content="Jay"/> 
      </ListBox.Items> 
     </ListBox> 
    </Grid> 
    <!-- End Right Pane --> 

</Grid> 

結果:

enter image description here

希望這有助於歡呼聲。

+0

PS如果你實際上從頭到尾製作一個IRC應用程序(強調完成它的部分),我們可以脫機聊天,我可能會願意捐贈一些時間到一個很酷的用戶界面你可以用它來擴展我的投資組合。除非我爲那些沒有完成任務的人做了太多的免費工作,這對我來說沒有任何幫助。祝你好運! :) –

+0

非常感謝@ChrisW。不,我們非常致力於完成這...這是一個即將推出的聊天服務器www.irc7.com與原來的MSN聊天幾乎相同的引擎...我們只需要現在做一個客戶端,並擺脫了自己的msnchat ocx沒有人想再使用...我很樂意爲gui設計提供任何幫助 –

0

將最後一個RowDefinition設置爲*,刪除邊距並更改VerticalAlignment = Top似乎適用於我。

<Grid Grid.Column="1" Margin="0,0,0,0"> 
     <Grid.RowDefinitions> 
      <RowDefinition Height="40"/> 
      <RowDefinition Height="30"/> 
      <RowDefinition Height="*"/> 
     </Grid.RowDefinitions> 
     <Rectangle Fill="#8686EA" Stroke="Black" StrokeThickness="0" Grid.Row="0" Margin="10,0,0,0" /> 
     <Rectangle Fill="#CCCCFF" Stroke="Black" StrokeThickness="0" Grid.Row="1" Margin="10,0,0,0" RenderTransformOrigin="0.505,0.719" /> 
     <ListBox x:Name="listBox" Grid.Row="2" Margin="10,0,0, 0" VerticalAlignment="Top"> 
      <ListBox.Items> 
       <ListBoxItem Content="Tewl"/> 
       <ListBoxItem Content="Ryu"/> 
       <ListBoxItem Content="Clint"/> 
       <ListBoxItem Content="Bak3r"/> 
       <ListBoxItem Content="sm0kex"/> 
       <ListBoxItem Content="Jack"/> 
       <ListBoxItem Content="Bam"/> 
       <ListBoxItem Content="Jay"/> 
      </ListBox.Items> 
     </ListBox> 
    </Grid> 
+0

它必須是我的上層平面 –