我有一个 WPF 应用程序,并且我使用扩展器。当我让扩展器折叠时,它一直占据空间。是否可以在 xaml 中释放空间?
这是一些代码:
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="3*"></RowDefinition>
<RowDefinition Height="4*"></RowDefinition>
<RowDefinition Height="2*"></RowDefinition>
</Grid.RowDefinitions>
<wpfx:BusyIndicator Name="BusyBar" IsBusy="{Binding IsBusy}" BusyContent="Uploading enrollment data..." Grid.Row="0" />
<Expander Grid.Row="1" IsExpanded="True" Header="Enrollment Files Upload">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions>
<StackPanel Orientation="Horizontal" Margin="3, 10" Grid.Row="0">
<TextBlock Text="Agencies:" VerticalAlignment="Center" />
<ComboBox x:Name="Agencies" DisplayMemberPath="PrimaryName" SelectedValuePath="AgentId"
SelectedItem="{Binding SelectedAgency}"
MinWidth="100" Margin="3,0,10,0" VerticalAlignment="Center" />
<TextBlock Text="Worksheet:" VerticalAlignment="Center" />
<TextBox x:Name="WorkSheetName" VerticalAlignment="Center" Margin="3,0,10,0" />
<Button x:Name="UploadFile"
MinWidth="70"
Margin="2"
HorizontalAlignment="Center"
VerticalAlignment="Center"
attachProperties:ButtonIcon.Icon="Resources/Images/add.png"
Content="Upload File" IsEnabled="{Binding EnrollmentFiles.Any}"
Style="{StaticResource ImageButtonStyle}" />
<Button x:Name="EnrollmentDelete"
MinWidth="70"
Margin="2"
HorizontalAlignment="Center"
VerticalAlignment="Center"
attachProperties:ButtonIcon.Icon="Resources/Images/Remove.png"
Content="Delete Enrollment" IsEnabled="{Binding EnrollmentFiles.Any}"
Style="{StaticResource ImageButtonStyle}" />
</StackPanel>
<c1:C1FlexGrid x:Name="EnrollmentFiles" Grid.Row="1"
AutoGenerateColumns="False"
IsReadOnly="True" Width="Auto"
ItemsSource="{Binding Path=EnrollmentFiles}"
SelectionMode="Row" KeepCurrentVisible="True"
SelectedItem="{Binding Path=SelectedEnrollmentFile, Mode=TwoWay}">
...
</c1:C1FlexGrid>
</Grid>
</Expander>
<Expander Grid.Row="2" IsExpanded="True" Header="First Data Entry Records">
<DataGrid x:Name="FirstEntries"
AutoGenerateColumns="False"
BaseControls:DataGridExtension.Columns="{Binding FirstEntryGridColumns}"
CanUserAddRows="False" IsReadOnly="True"
SelectedItem="{Binding Path=SelectedFirstEntry}">
...
</DataGrid>
</Expander>
<Expander Grid.Row="3" IsExpanded="True" Header="Enrollment Files Upload">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"></ColumnDefinition>
<ColumnDefinition Width="Auto"></ColumnDefinition>
<ColumnDefinition Width="Auto"></ColumnDefinition>
</Grid.ColumnDefinitions>
<StackPanel Orientation="Horizontal" Grid.Row="0" Grid.ColumnSpan="3" Margin="3,10">
...
</StackPanel>
<TextBlock x:Name="SelectedFirstEntry_NameOnAccount" Grid.Row="1" Grid.Column="0" />
<TextBlock x:Name="SelectedFirstEntry_AccountNo" Grid.Row="1" Grid.Column="1" Margin="3,0" />
<TextBlock x:Name="SelectedFirstEntry_MeterNo" Grid.Row="1" Grid.Column="2" Margin="3,0"/>
<DataGrid x:Name="Findings" Grid.Row="2"
AutoGenerateColumns="False"
BaseControls:DataGridExtension.Columns="{Binding FindingsGridColumns}"
CanUserAddRows="False">
...
</DataGrid>
</Grid>
</Expander>
</Grid>
谢谢