We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Controls (within Grid) inside Expander Controls are not resizing along with the main window

I have Expander Control which contains Grid . Inside Grid i have child controls(TextBoxes and labels ). But when i am trying to resize my  window,  Controls within Expander   not resizing along with Main window. i have set width property of Grid  to "Auto"  and width property of child controls also made "Auto" .

Can you please help me to fix this.

<Grid Width="auto">

<DockPanel LastChildFill="True" HorizontalAlignment="Stretch">

<ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" Margin="12">

<Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch" >

<StackPanel VerticalAlignment="Top">

<Expander Header="{x:Static properties:Resources.Identification}" Name="expIdentification" IsExpanded="True" VerticalAlignment="Top">

<Grid Width=" auto">

<ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto">

<Grid Width=" auto">

<Grid.ColumnDefinitions>

<ColumnDefinition Width="Auto" />

<ColumnDefinition Width="635*" />

</Grid.ColumnDefinitions>

<Grid.RowDefinitions>

<RowDefinition Height="Auto" />

<RowDefinition Height="auto" />

<RowDefinition Height="auto" />

<RowDefinition Height="auto" />

<RowDefinition Height="auto" />

<RowDefinition Height="auto" />

<RowDefinition Height="auto" />

<RowDefinition Height="auto" />

<RowDefinition Height="auto" />

<RowDefinition Height="auto" />

<RowDefinition Height="auto" />

<RowDefinition Height="auto" />

<RowDefinition Height="auto" />

<RowDefinition Height="auto" />

<RowDefinition Height="auto" />

<RowDefinition Height="auto" />

</Grid.RowDefinitions>

<Label Content="{Binding AssetCodeTxt}" Height="26" Width="auto" Margin="0,8,0,0" Name="lblAssetCode" VerticalAlignment="Top" HorizontalContentAlignment="Right" Grid.Row="1" />

<TextBox Height="26" Margin="8,8,369,0" Text="{Binding Code, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True}" IsEnabled="{Binding EnabledCode}" Name="txtAssetCode" VerticalAlignment="Top" Grid.Row="1" Validation.ErrorTemplate="{StaticResource TextBoxErrorTemplate}" Style="{StaticResource toolTipsTextBox}" Grid.Column="1" />

<Label Content="{Binding AssetDescTxt}" Height="26" Width="auto" Margin="0,8,0,0" Name="lblAssetDesc" VerticalAlignment="Top" Grid.Row="2" HorizontalContentAlignment="Right" />

<TextBox Height="26" Margin="8,8,8,0" Text="{Binding Name, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True}" Name="txtAssetDesc" VerticalAlignment="Top" Grid.Row="2" Validation.ErrorTemplate="{StaticResource TextBoxErrorTemplate}" Style="{StaticResource toolTipsTextBox}" Grid.Column="1" />

<ComboBox Height="26" Margin="8,8,369,0" Name="cboHierClass" ItemsSource="{Binding HierachyClassList}" VerticalAlignment="Top" Grid.Row="3" SelectedValue="{Binding HierarchyClass}" SelectedValuePath="Value" DisplayMemberPath="Name" IsEnabled="{Binding EnabledHierClass}" Grid.Column="1" />

<Label Content="{x:Static properties:Resources.HierarchyClass}" Height="26" Width="auto" Margin="0,8,0,0" Name="lblHierarchyClass" VerticalAlignment="Top" Grid.Row="3" HorizontalContentAlignment="Right" />

<Label Content="{x:Static properties:Resources.TemplateClass}" Height="26" Width="auto" Margin="0,8,0,0" Name="lblTemplateClass" VerticalAlignment="Top" Grid.Row="5" HorizontalContentAlignment="Right" Grid.RowSpan="2" />

<ComboBox Height="26" ItemsSource="{Binding TemplateClassList}" Margin="8,8,369,0" Name="cboTemplateClass" VerticalAlignment="Top" Grid.Row="5" SelectedValue="{Binding ClassIdentifier}" SelectedValuePath="Identifier" ItemTemplate="{StaticResource ComboTemplate}" Grid.Column="1">

</ComboBox>

<Label Content="{x:Static properties:Resources.TemplateType}" Height="26" Width="auto" Margin="0,8,0,0" Name="lblTemplateType" VerticalAlignment="Top" Grid.Row="6" HorizontalContentAlignment="Right" />

<ComboBox Height="26" ItemsSource="{Binding TemplateTypeList}" Margin="8,8,369,0" Name="cboTemplateType" VerticalAlignment="Top" Grid.Row="6"

SelectedValue="{Binding TypeIdentifier}" SelectedValuePath="Identifier" ItemTemplate="{StaticResource ComboTemplate}" Grid.Column="1" IsTextSearchEnabled="True" IsEditable="False">

</ComboBox>

<Label Content="{x:Static properties:Resources.ReviewStatus}" Height="26" Width="auto" Margin="0,8,0,0" Name="lblReviewStatus" Grid.Row="4" HorizontalContentAlignment="Right" VerticalAlignment="Top" />

<ComboBox Height="26" ItemsSource="{Binding ReviewStatusList}" Margin="8,8,369,0" Name="cboReviewStatus" VerticalAlignment="Top" Grid.Row="4"

SelectedValue="{Binding RevisionStatus}" SelectedValuePath="Value" DisplayMemberPath="Name" Grid.Column="1" />

<TextBox Height="47" Margin="8,8,8,0" Text="{Binding Function}" Name="txtFunction" VerticalAlignment="Top" Grid.Row="7" Grid.Column="1" />

<Label Content="{x:Static properties:Resources.Function}" Height="26" Width="auto" Margin="0,8,0,0" Name="lblFunction" VerticalAlignment="Top" Grid.Row="7" HorizontalContentAlignment="Right" />

<TextBox Height="47" Margin="8,8,8,0" Text="{Binding OperatingMode}" Name="txtOperatingMode" VerticalAlignment="Top" Grid.Row="8" Grid.Column="1" />

<Label Content="{x:Static properties:Resources.OperatingMode}" Height="26" Width="auto" Margin="0,8,0,0" Name="label2" VerticalAlignment="Top" Grid.Row="8" HorizontalContentAlignment="Right" />

<TextBox Height="47" Margin="8,8,8,0" Text="{Binding History}" Name="txtHistory" VerticalAlignment="Top" Grid.Row="9" Grid.Column="1" />

<Label Content="{x:Static properties:Resources.History}" Height="26" Width="auto" Margin="0,8,0,0" Name="lblHistory" VerticalAlignment="Top" Grid.Row="9" HorizontalContentAlignment="Right" />

<Label Content="{x:Static properties:Resources.Environment}" Height="26" Width="auto" Margin="0,8,0,0" Name="lblEnvironment" VerticalAlignment="Top" Grid.Row="10" HorizontalContentAlignment="Right" />

<TextBox Height="47" Margin="8,8,8,0" Text="{Binding Environment}" Name="cboEnvironment" VerticalAlignment="Top" Grid.Row="10" Grid.Column="1" />

<TextBox Height="26" Margin="8,8,571,0" Text="{Binding Revision}" Name="txtRevision" VerticalAlignment="Top" Grid.Row="11" Grid.Column="1" />

<Label Content="{x:Static properties:Resources.Revision}" Height="26" Width="auto" Margin="0,8,0,0" Name="lblRevision" VerticalAlignment="Top" Grid.Row="11" HorizontalContentAlignment="Right" />

<!--<TextBox Height="23" Margin="0,324,169,0" Text="{Binding RevisionDate}" Name="txtRevisionDate" VerticalAlignment="Top" HorizontalAlignment="Right" Width="212" Grid.Row="1" />-->

<DatePicker Margin="8,8,571,0" Name="dtRevisionDate" VerticalAlignment="Top" Grid.Row="12" Height="25" SelectedDate="{Binding RevisionDate}" Grid.Column="1"></DatePicker>

<Label Content="{x:Static properties:Resources.RevisionDate}" HorizontalAlignment="Right" Height="26" Width="auto" Margin="0,8,0,0" Name="lblRevisionDate" VerticalAlignment="Top" Grid.Row="12" HorizontalContentAlignment="Right" />

<Label Content="{x:Static properties:Resources.Critical}" Height="26" Width="auto" Margin="0,8,0,0" Name="lblCritical" VerticalAlignment="Top" Grid.Row="13" HorizontalContentAlignment="Right" />

<CheckBox Name="chkCritical" Margin="8,8,700,0" Height="16" VerticalAlignment="Top" HorizontalContentAlignment="Right" Grid.Row="13" IsEnabled="False" IsChecked="{Binding CriticalityMatrix}" Grid.Column="1"></CheckBox>

<Label Content="{x:Static properties:Resources.RunToFailure}" Height="26" Width="auto" Margin="0,8,0,0" Name="lblRTF" VerticalAlignment="Top" Grid.Row="14" HorizontalContentAlignment="Right" />

<CheckBox Name="chkRTF" Margin="8,8,700,0" Height="16" VerticalAlignment="Top" HorizontalContentAlignment="Right" Grid.Row="14" IsEnabled="False" IsChecked="{Binding RuntoFailure}" Grid.Column="1"></CheckBox>

<my1:DGFooter x:Name="dGFooter4" Grid.Column="1" Margin="8,0" />

<my1:ViewAssetCommitment Margin="8,8,8,0" x:Name="dgAssetCommitment" DataContext="{Binding CurrentAssetCommitmentView}" VerticalAlignment="Top" Height="181" Grid.Row="15" Grid.Column="1" />

<Label Content="{x:Static properties:Resources.Commitments}" Height="26" Width="auto" Margin="0,8,0,0" Name="label1" VerticalAlignment="Top" HorizontalContentAlignment="Right" Grid.Row="15" />

</Grid>

</ScrollViewer>

</Grid>

</Expander>

 

 

 


2 Replies

DK Dinesh Kumar P Syncfusion Team April 5, 2013 09:57 AM UTC

Hi Guru,

We are unable to reproduce the issue mentioned. Yet we have created a simple sample based on your query, please download the same from the following location.


In the sample we have added 'ComboBox' and 'TextBox' inside the Expander control. When window is resized it get resized automatically. But 'Label' will not get resized due to its default behavior. Please provide us a modified sample or more information regarding the issue to provide you an accurate solution.

Thanks and Regards,
Dinesh Kumar P


BR Brijesh April 19, 2018 07:26 AM UTC

I am facing similar issue with SfTreeGrid. Can you pls share the code as this says key not found exception when clicking the link

Loader.
Live Chat Icon For mobile
Up arrow icon