An Accordion
has only AccordionItem
children. You should set the child explicitly to the Accordion
like that (example of an Accordion
with a StackPanel
as a child and a template for the header):
<layoutToolkit:Accordion
x:Name="accordion"
ExpandDirection="Down"
HorizontalAlignment="Stretch"
HorizontalContentAlignment="Stretch"
SelectionChanged="Accordion_SelectionChanged"
AccordionButtonStyle="{StaticResource DateAccordionButtonStyle}"
Background="White"
Padding="2"
>
<layoutToolkit:AccordionItem x:Name="dayAI" Background="{StaticResource OutlookCalendarColor}" >
<layoutToolkit:AccordionItem.HeaderTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal" Margin="0,0,0,2">
<Image VerticalAlignment="Center" Source="{Binding Day, Source={StaticResource ImagesPath}}" Stretch="Uniform" />
<TextBlock FontWeight="Bold" VerticalAlignment="Center" Text="{Binding Resource.Day, Source={StaticResource LocalizedStrings}}" Margin="5,0,0,0" />
</StackPanel>
</DataTemplate>
</layoutToolkit:AccordionItem.HeaderTemplate>
<StackPanel >
<RadioButton Margin="5,5,5,5" x:Name="todayRB" GroupName="RBGroup" Content="{Binding Resource.Today, Source={StaticResource LocalizedStrings}}" Checked="RB_Checked"/>
<RadioButton Margin="5,5,5,5" x:Name="yesterdayRB" GroupName="RBGroup" Content="{Binding Resource.Yesterday, Source={StaticResource LocalizedStrings}}" Checked="RB_Checked"/>
<RadioButton Margin="5,5,5,5" x:Name="dayPickerRB" GroupName="RBGroup" Checked="RB_Checked">
<StackPanel Orientation="Horizontal" >
<TextBlock Text="{Binding Resource.Day, Source={StaticResource LocalizedStrings}}" Margin="0,0,5,0" VerticalAlignment="Center"/>
<Controls:DatePicker x:Name="dayPickerDP" />
</StackPanel>
</RadioButton>
</StackPanel>
</layoutToolkit:AccordionItem>
</layoutToolkit:Accordion>
So in your case it would be something like:
<Accordion>
<AccordionItem Header="My header text">
<DataGrid x:Name="MyDataGrid"/>
</AccordionItem>
</Accordion>
Hope that makes sense to you.