我有一个wpf应用程序与几种形式。在设计时它们很小,而且它们没有设置为自动调整大小。不过在运行时他们是巨人,即使没有内容让他们变大。
原文链接:https://www.f2er.com/windows/372474.html为什么会发生这种情况?
这是一种形式
<Window x:Class="SuperPluginPicker" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:tree="clr-namespace:Aga.Controls.Tree;assembly=Aga.Controls" mc:Ignorable="d" d:DesignHeight="296" d:DesignWidth="634" Title="Plugin Selector" WindowStartupLocation="CenterOwner"> <Grid> <DockPanel LastChildFill="true"> <StackPanel DockPanel.Dock="Bottom" Height="30" Orientation="Horizontal"> <Button Content="Ok" Name="btnOk" Click="btnOk_Click"></Button> <Button Content="Cancel" Name="btnCancel" Click="btnCancel_Click"></Button> </StackPanel> <StackPanel DockPanel.Dock="Right"> <Label Content="Selected Plugins"></Label> <ListBox Name="lstSelectedPlugins" Width="200"> <ListBox.ItemTemplate> <DataTemplate> <Label Content="{Binding Name}" /> </DataTemplate> </ListBox.ItemTemplate> </ListBox> </StackPanel> <StackPanel DockPanel.Dock="Right" Width="100" VerticalAlignment="Center"> <Button Content="Add" Name ="btnAdd" Click="btnAdd_Click"></Button> <Button Content="Remove" Name="btnRemove" Click="btnRemove_Click"></Button> <Button Content="Remove All" Name="btnRemoveAll" Click="btnRemoveAll_Click"></Button> </StackPanel> <tree:TreeList x:Name="pluginTree"> <tree:TreeList.View> <GridView x:Name="treeGrid"> <GridView.Columns> <GridViewColumn Width="Auto" Header="Name"> <GridViewColumn.CellTemplate> <DataTemplate> <StackPanel Orientation="Horizontal"> <tree:RowExpander/> <TextBlock Text="{Binding Name}"></TextBlock> </StackPanel> </DataTemplate> </GridViewColumn.CellTemplate> </GridViewColumn> <GridViewColumn Header="Author" Width="Auto" DisplayMemberBinding="{Binding Author}"/> <GridViewColumn Header="Description" Width="Auto" DisplayMemberBinding="{Binding Type}"/> </GridView.Columns> </GridView> </tree:TreeList.View> </tree:TreeList> </DockPanel> </Grid> </Window>