I have a Datagrid with Expander in it, like this:
<DataGrid ItemsSource="{Binding}" Name="MainDataGrid"
AutoGenerateColumns="False"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
SelectionMode="Extended"
CanUserDeleteRows="False"
CanUserAddRows="False"
SelectiveScrollingGrid.SelectiveScrollingOrientation="Vertical"
>
<DataGrid.GroupStyle>
<GroupStyle>
<GroupStyle.ContainerStyle>
<Style TargetType="{x:Type GroupItem}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type GroupItem}">
<Expander Background="#F0F7FC" BorderThickness="0" BorderBrush="BlanchedAlmond" >
<Expander.Header>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
<TextBlock Text="Text" />
</StackPanel>
</Expander.Header>
<ItemsPresenter />
</Expander >
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</GroupStyle.ContainerStyle>
</GroupStyle>
</DataGrid.GroupStyle>
</DataGrid>
The datagrid has a frozen column and some variable ones. When i scroll vertically, the expander header also scrolls away and disappears. Is there a way to freeze the expander heaeder,too?
DataGrid before scrolling:
DataGrid after scrolling (Expander header scrolls away):