MaterialDesignInXamlToolkit
MaterialDesignInXamlToolkit copied to clipboard
Collapsed Expander crashes my app
Hello Guys, I have Tried to put a DataGrid in to an Expender Object.
On the MADesign Style my App was crashed, with the Win Styled Expander the app is working here my Code:
Working Code:
<Expander Style="{DynamicResource MaterialDesignExpander}" Name="MyExpander" Margin="10,10" HorizontalAlignment="Stretch" BorderBrush="{DynamicResource MaterialDesignBody}">
<Expander.Content>
<Grid>
<DataGrid Name="dataGrid1"
ScrollViewer.HorizontalScrollBarVisibility="Visible"
Cursor="Hand"
Grid.Row="1"
Grid.ColumnSpan="4"
MaxHeight="400"
MaxWidth="2000"
Width="auto"
Height="auto"
VerticalAlignment="Top"
EnableColumnVirtualization="True"
EnableRowVirtualization="True"
ItemsSource="{Binding ListOfHeaderData, IsAsync=True}" />
</Grid>
</Expander.Content>
<Expander.Style>
<Style TargetType="Expander">
<Setter Property="IsExpanded" Value="False" />
<Setter Property="Header" Value="Click to See More" />
<Style.Triggers>
<DataTrigger Binding="{Binding IsExpanded,RelativeSource={RelativeSource Self} Value="True">
<Setter Property="Header" Value="Click to See Less" />
</DataTrigger>
</Style.Triggers>
</Style>
</Expander.Style>
</Expander>
And the Code where crash:
<Expander Grid.Row="1" Grid.ColumnSpan="3" Style="{DynamicResource MaterialDesignExpander}" IsExpanded="True" Header="Baugruppen Auswahl:">
<Grid MaxHeight="460">
<DataGrid Name="dataGrid1"
ScrollViewer.HorizontalScrollBarVisibility="Visible"
Cursor="Hand"
Grid.Row="1"
Grid.ColumnSpan="4"
MaxHeight="400"
MaxWidth="2000"
Width="auto"
Height="400"
VerticalAlignment="Top"
EnableColumnVirtualization="True"
EnableRowVirtualization="True"
ItemsSource="{Binding ListOfHeaderData, IsAsync=True}" />
</Grid>
</Expander>
I think the renderer trys in collapsed mode to render all Data inside my datasource without restrictions. And fills my RAM with lots off Data.
I think the solve is in the Style section from the working code. But if I use this section the Expander has no MADesign.
I am an WPF beginner and need help to fix that :(
I hope someone can help me.
Can you provide a test repo please ? It would help us to solve the problem.