This is a migrated thread and some comments may be shown as answers.

Expander within an Expander?

8 Answers 66 Views
Expander
This is a migrated thread and some comments may be shown as answers.
Jim
Top achievements
Rank 1
Jim asked on 17 Aug 2015, 03:21 PM

Can you have an Expander within an Expander?  User is wanting to break out two different options the second will be active if certain criteria is set else where (basically additional questions that need to be answered.  When I tried to set up an example it is telling me that "Content" is set multiple times, so I'm not sure if it's because I can't do this or if I have to set it up differently.  Below is code I was testing with:

<!--Christmas Trees  Option M -->                     <Border Grid.Row="11" Grid.ColumnSpan="7" CornerRadius="0" HorizontalAlignment="Stretch" VerticalAlignment="Bottom" Margin="5" Background="Transparent">                         <telerik:RadExpander x:Name="ChristmasTrees" ExpandDirection="Down" VerticalAlignment="Top" Margin="0" >                             <telerik:RadExpander.Header>                                 <TextBlock Text=" Christmas Trees" />                             </telerik:RadExpander.Header>                             <telerik:RadExpander.Content>                                 <ContentControl Background="Transparent" HorizontalContentAlignment="Stretch" IsEnabled="{Binding IsSDI_PropertyOptionMExpandedOperational, Mode=TwoWay}">                                     <Grid>                                         <Grid.ColumnDefinitions>                                             <ColumnDefinition Width="Auto"/>                                             <ColumnDefinition Width="Auto"/>                                             <ColumnDefinition Width="Auto"/>                                             <ColumnDefinition Width="Auto"/>                                         </Grid.ColumnDefinitions>                                         <Grid.RowDefinitions>                                             <RowDefinition/>                                             <RowDefinition/>                                             <RowDefinition/>                                             <RowDefinition/>                                             <RowDefinition/>                                             <RowDefinition/>                                             <RowDefinition/>                                             <RowDefinition/>                                             <RowDefinition/>                                             <RowDefinition/>                                             <RowDefinition/>                                             <RowDefinition/>                                         </Grid.RowDefinitions>                                         <TextBlock Grid.Row="0" Grid.Column="0" Text="Are the annual gross receipts for the flower, greenhouse, nursery, Christmas Tree" VerticalAlignment="Center" Margin="5" />                                         <TextBlock Grid.Row="1" Grid.Column="0" Text="   business incidental to the annual gross receipts for the farming operation? " VerticalAlignment="Center" Margin="5" />                                         <StackPanel Grid.Row="1" Grid.Column="1" Orientation="Horizontal" Margin="0">                                             <RadioButton GroupName="AnnualGrossReceiptsIncidentalFlower" Content="Yes" IsChecked="{Binding FlowerGreenhouseNurseryChristmasTree.AnnualGrossReceiptsIncidental, Mode=TwoWay}" Margin="5" />                                             <RadioButton GroupName="AnnualGrossReceiptsIncidentalFlower" Content="No" IsChecked="{Binding FlowerGreenhouseNurseryChristmasTree.AnnualGrossReceiptsIncidental, Mode=TwoWay, Converter={StaticResource BoolInverseConverter}}"  Margin="5" />                                         </StackPanel>                                         <TextBlock Grid.Row="2" Grid.Column="0" Text="What type of plants or produce are being grown and/or sold? " VerticalAlignment="Center" Margin="5" />                                         <StackPanel Grid.Row="2" Grid.Column="1" Orientation="Horizontal" Margin="0">                                             <CheckBox Name="Flowers3" Content="Flowers" IsChecked="{Binding FlowerGreenhouseNurseryChristmasTree.HasFlowers, Mode=TwoWay}" Margin="5" />                                             <CheckBox Name="Fruit3" Content="Fruits" IsChecked="{Binding FlowerGreenhouseNurseryChristmasTree.HasFruit, Mode=TwoWay}" Margin="5" />                                             <CheckBox Name ="Vegetables3" Content="Vegetables" IsChecked="{Binding FlowerGreenhouseNurseryChristmasTree.HasVegetables, Mode=TwoWay}" Margin="5" />                                         </StackPanel>                                         <StackPanel Grid.Row="3" Grid.Column="1" Orientation="Horizontal" Margin="0">                                             <CheckBox Name ="Shrubs3" Content="Shrubs" IsChecked="{Binding FlowerGreenhouseNurseryChristmasTree.HasShrubs, Mode=TwoWay}" Margin="5" />                                             <CheckBox Name="Trees3" Content="Trees" IsChecked="{Binding FlowerGreenhouseNurseryChristmasTree.HasTrees, Mode=TwoWay}" Margin="5" />                                             <CheckBox Name="Other3" Content="Other Plants" IsChecked="{Binding FlowerGreenhouseNurseryChristmasTree.HasOther, Mode=TwoWay}" Margin="5" />                                         </StackPanel>                                         <TextBlock Grid.Row="4" Grid.Column="0" Text="What are the annual gross receipts sold on premises? " VerticalAlignment="Center" Margin="5"/>                                         <telerikInput:RadMaskedCurrencyInput Grid.Row="4" Grid.Column="1" Value="{Binding FlowerGreenhouseNurseryChristmasTree.AnnualGrossReceiptsOnPremises, Mode=TwoWay, Converter={StaticResource StringToDecimalConverter}}" Mask="#9.2" Margin="5" Width="100"                                                    HorizontalContentAlignment="Left" EmptyContent="0" SelectionOnFocus="SelectAll" TextMode="PlainText"/>                                         <TextBlock Grid.Row="5" Grid.Column="0" Text="What are the annual gross receipts sold off premises? " VerticalAlignment="Center" Margin="5"/>                                         <telerikInput:RadMaskedCurrencyInput Grid.Row="5" Grid.Column="1" Value="{Binding FlowerGreenhouseNurseryChristmasTree.AnnualGrossReceiptsOffPremises, Mode=TwoWay, Converter={StaticResource StringToDecimalConverter}}" Mask="#9.2" Margin="5" Width="100"                                                    HorizontalContentAlignment="Left" EmptyContent="0" SelectionOnFocus="SelectAll" TextMode="PlainText"/>                                         <TextBlock Grid.Row="6" Grid.Column="0" Text="Is there any processing of products? " VerticalAlignment="Center" Margin="5" />                                         <StackPanel Grid.Row="6" Grid.Column="1" Orientation="Horizontal" Margin="0">                                             <RadioButton GroupName="ProductProcessing" Content="Yes" IsChecked="{Binding FlowerGreenhouseNurseryChristmasTree.ProductProcessing, Mode=TwoWay}" Margin="5" />                                             <RadioButton GroupName="ProductProcessing" Content="No" IsChecked="{Binding FlowerGreenhouseNurseryChristmasTree.ProductProcessing, Mode=TwoWay, Converter={StaticResource BoolInverseConverter}}"  Margin="5" />                                         </StackPanel>                                         <TextBlock Grid.Row="7" Grid.Column="0" Text="Is there a retail store on the premises? " VerticalAlignment="Center" Margin="5" />                                         <StackPanel Grid.Row="7" Grid.Column="1" Orientation="Horizontal" Margin="0">                                             <RadioButton GroupName="RetailStoreOnPremises" Content="Yes" IsChecked="{Binding FlowerGreenhouseNurseryChristmasTree.RetailStoreOnPremises, Mode=TwoWay}" Margin="5" />                                             <RadioButton GroupName="RetailStoreOnPremises" Content="No" IsChecked="{Binding FlowerGreenhouseNurseryChristmasTree.RetailStoreOnPremises, Mode=TwoWay, Converter={StaticResource BoolInverseConverter}}"  Margin="5" />                                         </StackPanel>                                         <TextBlock Grid.Row="8" Grid.Column="0" Text="Remarks about the business:" VerticalAlignment="Center" Margin="5"/>                                         <TextBox Grid.Row="8" Grid.Column="1" Grid.ColumnSpan="3" Text="{Binding FlowerGreenhouseNurseryChristmasTree.BusinessRemarks, Mode=TwoWay}" Margin="5" Height="25" Width="600" MaxLength="550" HorizontalAlignment="Left"/>                                     </Grid>                                 </ContentControl>                             </telerik:RadExpander.Content>                             <telerik:RadExpander x:Name="ChristmasTreesProducts" ExpandDirection="Down" VerticalAlignment="Top" Margin="0" >                                 <telerik:RadExpander.Header>                                     <TextBlock Text=" Christmas Trees Products" />                                 </telerik:RadExpander.Header>                                 <telerik:RadExpander.Content>                                     <ContentControl Background="Transparent" HorizontalContentAlignment="Stretch" IsEnabled="{Binding IsSDI_PropertyOptionMExpandedOperational, Mode=TwoWay}">                                         <Grid>                                             <Grid.ColumnDefinitions>                                                 <ColumnDefinition Width="Auto"/>                                                 <ColumnDefinition Width="Auto"/>                                                 <ColumnDefinition Width="Auto"/>                                                 <ColumnDefinition Width="Auto"/>                                             </Grid.ColumnDefinitions>                                             <Grid.RowDefinitions>                                                 <RowDefinition/>                                                 <RowDefinition/>                                                 <RowDefinition/>                                                 <RowDefinition/>                                                 <RowDefinition/>                                                 <RowDefinition/>                                                 <RowDefinition/>                                                 <RowDefinition/>                                                 <RowDefinition/>                                                 <RowDefinition/>                                                 <RowDefinition/>                                                 <RowDefinition/>                                             </Grid.RowDefinitions>                                             <TextBlock Grid.Row="0" Grid.Column="0" Text="Are the annual gross receipts for the flower, greenhouse, nursery, Christmas Tree" VerticalAlignment="Center" Margin="5" />                                             <TextBlock Grid.Row="1" Grid.Column="0" Text="   business incidental to the annual gross receipts for the farming operation? " VerticalAlignment="Center" Margin="5" />                                             <StackPanel Grid.Row="1" Grid.Column="1" Orientation="Horizontal" Margin="0">                                                 <RadioButton GroupName="AnnualGrossReceiptsIncidentalFlower" Content="Yes" IsChecked="{Binding FlowerGreenhouseNurseryChristmasTree.AnnualGrossReceiptsIncidental, Mode=TwoWay}" Margin="5" />                                                 <RadioButton GroupName="AnnualGrossReceiptsIncidentalFlower" Content="No" IsChecked="{Binding FlowerGreenhouseNurseryChristmasTree.AnnualGrossReceiptsIncidental, Mode=TwoWay, Converter={StaticResource BoolInverseConverter}}"  Margin="5" />                                             </StackPanel>                                             <TextBlock Grid.Row="2" Grid.Column="0" Text="What type of plants or produce are being grown and/or sold? " VerticalAlignment="Center" Margin="5" />                                             <StackPanel Grid.Row="2" Grid.Column="1" Orientation="Horizontal" Margin="0">                                                 <CheckBox Name="Flowers3" Content="Flowers" IsChecked="{Binding FlowerGreenhouseNurseryChristmasTree.HasFlowers, Mode=TwoWay}" Margin="5" />                                                 <CheckBox Name="Fruit3" Content="Fruits" IsChecked="{Binding FlowerGreenhouseNurseryChristmasTree.HasFruit, Mode=TwoWay}" Margin="5" />                                                 <CheckBox Name ="Vegetables3" Content="Vegetables" IsChecked="{Binding FlowerGreenhouseNurseryChristmasTree.HasVegetables, Mode=TwoWay}" Margin="5" />                                             </StackPanel>                                             <StackPanel Grid.Row="3" Grid.Column="1" Orientation="Horizontal" Margin="0">                                                 <CheckBox Name ="Shrubs3" Content="Shrubs" IsChecked="{Binding FlowerGreenhouseNurseryChristmasTree.HasShrubs, Mode=TwoWay}" Margin="5" />                                                 <CheckBox Name="Trees3" Content="Trees" IsChecked="{Binding FlowerGreenhouseNurseryChristmasTree.HasTrees, Mode=TwoWay}" Margin="5" />                                                 <CheckBox Name="Other3" Content="Other Plants" IsChecked="{Binding FlowerGreenhouseNurseryChristmasTree.HasOther, Mode=TwoWay}" Margin="5" />                                             </StackPanel>                                             <TextBlock Grid.Row="4" Grid.Column="0" Text="What are the annual gross receipts sold on premises? " VerticalAlignment="Center" Margin="5"/>                                             <telerikInput:RadMaskedCurrencyInput Grid.Row="4" Grid.Column="1" Value="{Binding FlowerGreenhouseNurseryChristmasTree.AnnualGrossReceiptsOnPremises, Mode=TwoWay, Converter={StaticResource StringToDecimalConverter}}" Mask="#9.2" Margin="5" Width="100"                                                    HorizontalContentAlignment="Left" EmptyContent="0" SelectionOnFocus="SelectAll" TextMode="PlainText"/>                                             <TextBlock Grid.Row="5" Grid.Column="0" Text="What are the annual gross receipts sold off premises? " VerticalAlignment="Center" Margin="5"/>                                             <telerikInput:RadMaskedCurrencyInput Grid.Row="5" Grid.Column="1" Value="{Binding FlowerGreenhouseNurseryChristmasTree.AnnualGrossReceiptsOffPremises, Mode=TwoWay, Converter={StaticResource StringToDecimalConverter}}" Mask="#9.2" Margin="5" Width="100"                                                    HorizontalContentAlignment="Left" EmptyContent="0" SelectionOnFocus="SelectAll" TextMode="PlainText"/>                                             <TextBlock Grid.Row="6" Grid.Column="0" Text="Is there any processing of products? " VerticalAlignment="Center" Margin="5" />                                             <StackPanel Grid.Row="6" Grid.Column="1" Orientation="Horizontal" Margin="0">                                                 <RadioButton GroupName="ProductProcessing" Content="Yes" IsChecked="{Binding FlowerGreenhouseNurseryChristmasTree.ProductProcessing, Mode=TwoWay}" Margin="5" />                                                 <RadioButton GroupName="ProductProcessing" Content="No" IsChecked="{Binding FlowerGreenhouseNurseryChristmasTree.ProductProcessing, Mode=TwoWay, Converter={StaticResource BoolInverseConverter}}"  Margin="5" />                                             </StackPanel>                                             <TextBlock Grid.Row="7" Grid.Column="0" Text="Is there a retail store on the premises? " VerticalAlignment="Center" Margin="5" />                                             <StackPanel Grid.Row="7" Grid.Column="1" Orientation="Horizontal" Margin="0">                                                 <RadioButton GroupName="RetailStoreOnPremises" Content="Yes" IsChecked="{Binding FlowerGreenhouseNurseryChristmasTree.RetailStoreOnPremises, Mode=TwoWay}" Margin="5" />                                                 <RadioButton GroupName="RetailStoreOnPremises" Content="No" IsChecked="{Binding FlowerGreenhouseNurseryChristmasTree.RetailStoreOnPremises, Mode=TwoWay, Converter={StaticResource BoolInverseConverter}}"  Margin="5" />                                             </StackPanel>                                             <TextBlock Grid.Row="8" Grid.Column="0" Text="Remarks about the business:" VerticalAlignment="Center" Margin="5"/>                                             <TextBox Grid.Row="8" Grid.Column="1" Grid.ColumnSpan="3" Text="{Binding FlowerGreenhouseNurseryChristmasTree.BusinessRemarks, Mode=TwoWay}" Margin="5" Height="25" Width="600" MaxLength="550" HorizontalAlignment="Left"/>                                         </Grid>                                     </ContentControl>                                 </telerik:RadExpander.Content>                             </telerik:RadExpander>                         </telerik:RadExpander>                     </Border>

8 Answers, 1 is accepted

Sort by
0
Sia
Telerik team
answered on 20 Aug 2015, 06:18 AM
Hello Jim,

The structure of your page needs to be changed. You need to set the second expander as content of the first one and that is why you have such exception. Please find attached the needed layout and let us know if you need additional help with this.

Regards,
Sia
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Jim
Top achievements
Rank 1
answered on 20 Aug 2015, 12:45 PM
I was not able to download this file: SilverlightApplication5.rar ?
0
Jim
Top achievements
Rank 1
answered on 20 Aug 2015, 01:01 PM
This is what it gives me for a file name:  2f20acd1-60c0-48ce-af85-de7981d5ac11_SilverlightApplication5_rar?sfvrsn=0
0
Sia
Telerik team
answered on 21 Aug 2015, 03:17 PM
Hello again,

Maybe there is a problem with the forum on your end. However it is normal to see such name of the file because it is auto-generated. Please find the same zip attached again to this answer and let me know whether you can download it.

Regards,
Sia
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Jim
Top achievements
Rank 1
answered on 24 Aug 2015, 12:16 PM

Thanks!  I was able to download that one.

 I appreciate it,

-- Jim

0
Jim
Top achievements
Rank 1
answered on 11 Sep 2015, 02:50 PM

I'm able to make this work except for when contentcontrol has IsEnabled set to false then it will expand but the second expander is grayed out and cannot be expanded.  I need to be able to also expand this second expander (this is in a non-edit mode but still need to be able to see the data that was entered (if any)

 How can I do this (or can it be done)?

Thanks,

-- Jim

0
Jim
Top achievements
Rank 1
answered on 11 Sep 2015, 02:56 PM
and over riding the IsEnabled on the second ContentControl to true does not effect  the second expander being grayed out and not functional
0
Sia
Telerik team
answered on 15 Sep 2015, 08:47 AM
Hello,

This behavior is expected because the IsEnable property is propagated through all nested elements. There are several possible solutions depending on your exact scenario and setup.

1. The first one is to disable only the elements that you do not want to have direct input one by one - by code or by binding, but leave their parent ContentControl enabled. 
2. The second one is to bind the IsExpanded property of the second expander to the parent expander. This way when the first ContentControl is disabled and you click the parent expander, the second one will be also expanded and its content will be visible. However I am not sure whether this is appropriate for your application. 

Please let me know whether this helps.

Regards,
Sia
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
Expander
Asked by
Jim
Top achievements
Rank 1
Answers by
Sia
Telerik team
Jim
Top achievements
Rank 1
Share this question
or