0
votes

I'm having trouble selecting the correct template to manage the content of an expander control.
I'd like the content of an expander -- regardless of the type of control that is the content -- to be indented.
For example, an expander might have an expander as content, then the child expander might have a listbox, or a collection of textblocks.

Any help would be appreciated....

UPDATE:
Experimenting with a DataTemplate like this:

<DataTemplate x:Key="DataTemplate1">
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="20" />
                <ColumnDefinition Width="Auto" />
            </Grid.ColumnDefinitions>  
            <ContentPresenter Grid.Row="1" />  <!-- With this in place, content doesn't show at all -->
        </Grid>
    </DataTemplate>  

And using it like this:

    <controls2:Expander Header="Two" ContentTemplate="{StaticResource DataTemplate1}">

So far, any attempts to deal with the content crashes the app when the Expander is expanded.

1
Do you have details of the crash?ChrisF♦
No, I've removed the crashing code and am experimenting with other approaches. Currently, the app doesn't crash, but now the content doesn't show at all.Number8
Added <ContentPresenter /> to xaml; now, content does not display at all.Number8
Got it working -- needed a Style targeting the ContentControl and setting the Template property with a ControlTemplate. Now, to figure out how to combine this with a HierarchicalDataTemplate...Number8

1 Answers

2
votes

I Think This Code Should Help You

    <toolkit:Accordion x:Name="SearchAcco" Grid.Row="0" Margin="3"  ExpandDirection="Down" HorizontalAlignment="Stretch" SelectionMode="ZeroOrOne">
                <toolkit:AccordionItem Header="Advance Search" Style="{StaticResource AccordianPanalStyle}"  HorizontalContentAlignment="Left">
<--Add Content Here-->
</toolkit:AccordionItem>


     </toolkit:Accordion>