я разрабатываю приложение WPF;моя проблема, когда я максимизирую окна и после того, как я минимизирую / изменяю размеры;контроль, при максимизации идет хорошо, но когда я минимизирую / изменяю размер окна, контроль (textblock, combobox) не делает и сохраняет максимизированное измерение.Как я могу изменить размер элемента управления при сворачивании?
Вот пример моего кода XAML:
<UserControl x:Class="MyNamespace.UC.Suppliers_Insert"
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:local="clr-namespace:MyNamespace.UC"
xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<DockPanel Name="MainDock" LastChildFill="True" DataContext="{Binding Suppliers_Insert, Source={StaticResource Locator}}"
VerticalAlignment="Stretch"
Height="Auto">
<Grid>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Name="wRow0" Height="*"/>
<RowDefinition Name="wRow1" Height="*"/>
<RowDefinition Name="wRow2" Height="*"/>
<RowDefinition Name="wRow3" Height="*"/>
<RowDefinition Name="wRow4" Height="*"/>
</Grid.RowDefinitions>
<telerik:RadWatermarkTextBox Grid.Column="0" Grid.Row="0" WatermarkContent="Supplier Name" Text="{Binding SupplierModel.Supplier_Name, ValidatesOnDataErrors=True, UpdateSourceTrigger=PropertyChanged}"
Style="{StaticResource RadWatermarkTextBoxStyle_UserNamme}" Margin="5,5,5,0" Visibility="{Binding Supplier_Name_Visibility}" IsEnabled="{Binding Supplier_Fields_Enable}"
Validation.ErrorTemplate="{StaticResource MyTemplateError}"/>
<telerik:RadWatermarkTextBox Grid.Column="0" Grid.Row="1" WatermarkContent="Vat Number" Text="{Binding SupplierModel.VAT_Number, ValidatesOnDataErrors=True, UpdateSourceTrigger=PropertyChanged}"
Style="{StaticResource RadWatermarkTextBoxStyle_UserNamme}" Margin="5,5,5,0" Visibility="{Binding VAT_Number_Visibility}" IsEnabled="{Binding Supplier_Fields_Enable}"
Validation.ErrorTemplate="{StaticResource MyTemplateError}"/>
<telerik:RadWatermarkTextBox Grid.Column="0" Grid.Row="2" WatermarkContent="Tax Code" Text="{Binding SupplierModel.Tax_Code, ValidatesOnDataErrors=True, UpdateSourceTrigger=PropertyChanged}"
Style="{StaticResource RadWatermarkTextBoxStyle_UserNamme}" Margin="5,5,5,0" Visibility="{Binding Tax_Code_Visibility}" IsEnabled="{Binding Supplier_Fields_Enable}"
Validation.ErrorTemplate="{StaticResource MyTemplateError}"/>
<telerik:RadWatermarkTextBox Grid.Column="0" Grid.Row="3" WatermarkContent="External Supplier ID" Text="{Binding SupplierModel.External_Supplier_ID, ValidatesOnDataErrors=True, UpdateSourceTrigger=PropertyChanged}"
Style="{StaticResource RadWatermarkTextBoxStyle_UserNamme}" Margin="5,5,5,0" Visibility="{Binding External_Supplier_ID_Visibility}" IsEnabled="{Binding Supplier_Fields_Enable}"
Validation.ErrorTemplate="{StaticResource MyTemplateError}"/>
<telerik:RadWatermarkTextBox Grid.Column="1" Grid.Row="0" Grid.ColumnSpan="2" Grid.RowSpan="3" WatermarkContent="Note" AcceptsReturn="True" Text="{Binding SupplierModel.Note, ValidatesOnDataErrors=True, UpdateSourceTrigger=PropertyChanged}"
Style="{StaticResource RadWatermarkTextBoxStyle_UserNamme}" Margin="5,5,5,0" Visibility="{Binding Note_Visibility}" IsEnabled="{Binding Supplier_Fields_Enable}"
Validation.ErrorTemplate="{StaticResource MyTemplateError}"/>
<telerik:RadWatermarkTextBox Grid.Column="1" Grid.Row="1" Grid.ColumnSpan="2" WatermarkContent="Website" Text="{Binding SupplierModel.Website, ValidatesOnDataErrors=True, UpdateSourceTrigger=PropertyChanged}"
Style="{StaticResource RadWatermarkTextBoxStyle_UserNamme}" Margin="5,5,5,0" Visibility="{Binding Website_Visibility}" IsEnabled="{Binding Supplier_Fields_Enable}"
Validation.ErrorTemplate="{StaticResource MyTemplateError}"/>
<telerik:RadButton x:Name="rdb_Insert" Grid.Row="3" Grid.Column="3" HorizontalAlignment="Right" Margin="10,0,10,0" VerticalAlignment="Center" Content="{DynamicResource rsBtn_Insert}" Width="75"
Visibility="{Binding InsertButtonVisibility}" Command="{Binding SaveNavigationCommand}" />
<telerik:RadButton x:Name="rdb_Cancel" Grid.Row="4" Grid.Column="3" HorizontalAlignment="Right" Margin="10,0,10,0" VerticalAlignment="Center" Content="{DynamicResource rsBtn_Cancel}" Width="75"
Command="{Binding CancelNavigationCommand}" Visibility="{Binding CancelButtonVisibility}" />
<telerik:RadButton x:Name="rdb_Close" Grid.Row="4" Grid.Column="3" HorizontalAlignment="Right" Margin="10,0,10,0" VerticalAlignment="Center"
Content="{DynamicResource rsBtn_Close}" Width="75" Command="{Binding CancelButtonVisibility}" Visibility="{Binding CloseButtonVisibility}"/>
</Grid>
</Grid>
</DockPanel>
Спасибо.
РЕДАКТИРОВАТЬ: Я забыл указать, что UC входит в StackPanel в моем MainView.Я изменил SP на Grid, и теперь содержимое будет изменяться правильно, когда окна свернуты.