簡體   English   中英

改進的表示方式和標點符號

[英]Improved presentation and punctuation

我在網格內有一個網格。 無論窗口大小如何,我都希望它可以使用最大大小:

  • Main_Grid應該為最大寬度
  • Grid_tool_bar應該是最大寬度

但實際上並非如此,我無法找到原因。 這是代碼:

<Window x:Class="SocialNetworkingApp.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Background="White" WindowStyle="None" HorizontalAlignment="Stretch" WindowState="Normal" AllowsTransparency="True" WindowStartupLocation="CenterScreen">
    <Border Margin="0,0,0,0" BorderBrush="Black" BorderThickness="1,1,1,1" >
        <Grid x:Name="Main_Grid" Background="White" Width="Auto" Height="Auto" Margin="0,0,0,0" HorizontalAlignment="Left" VerticalAlignment="Top">
            <Grid.RowDefinitions>
                <RowDefinition Height="30" />
                <RowDefinition Height="25"/>
                <RowDefinition Height="50"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="20"/>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="1*"/>
            </Grid.ColumnDefinitions>
            <Grid Name="Title_Bar" Grid.Row="0" VerticalAlignment="Top" ShowGridLines="True" Grid.IsSharedSizeScope="True" MouseDown="Drag_Window" Background="#FF4FA2DA" HorizontalAlignment="Left" Width="766" Height="31">
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto" />
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="30"/>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="120" />
                </Grid.ColumnDefinitions>
            </Grid>
        </Grid>
    </Border>
</Window>

通過最小化屬性來解決

<Window x:Class="SocialNetworkingApp.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Background="White" WindowStyle="None"  WindowState="Normal" AllowsTransparency="True" WindowStartupLocation="CenterScreen">
    <Border Margin="0,0,0,0" BorderBrush="Black" BorderThickness="1,1,1,1" >
        <Grid x:Name="Main_Grid" Background="White" >
            <Grid.RowDefinitions>
                <RowDefinition Height="10" />
                <RowDefinition Height="20"/>
                <RowDefinition Height="40"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="20"/>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="1*"/>
            </Grid.ColumnDefinitions>
            <Grid Name="Title_Bar" Grid.Row="0" Height="Auto" Background="#FF4FA2DA" >
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto" />
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="30"/>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="120" />
                </Grid.ColumnDefinitions>
            </Grid>
        </Grid>
    </Border>
</Window>
 <Grid Name="Title_Bar" Grid.Row="0" ... Width="766" Height="31">

如果要自動調整寬度,請不要指定寬度。 只需刪除該屬性。

編輯:以及刪除HorizontalAlignment="Left"設置器。 至少對於外部網格。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM