Hey,
Problem:
I have a SfDataGrid:
<sf:SfDataGrid
x:Name="ResultJobsDataGrid"
Grid.Row="1"
local:SfDataGridBehaviors.ColumnsMinimumWidth="3"
BorderBrush="{DynamicResource Brush.Stroke.Enabled.1}"
BorderThickness="0,1,0,1"
EnableDataVirtualization="False"
IsEnabled="{Binding IsBusy, Converter={x:Static controls:ValueConverters.InvertBool}}"
ItemsSource="{Binding Jobs}"
SelectedItem="{Binding SelectedJob}"
Style="{StaticResource Style.SFDataGrid.BrowseResults}">
<i:Interaction.Behaviors>
<local:SfDataGridBehaviors />
</i:Interaction.Behaviors>
</sf:SfDataGrid>
Displaying items bound by a datatemplate
<DataTemplate x:Key="DisplayNameCellTemplate" DataType="{x:Type local:ArchiveItemViewModel}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Image
Width="50"
Margin="32,0,0,0"
Source="{Binding Thumbnail}"
Stretch="Uniform" />
<TextBlock
Grid.Column="1"
Margin="8,0,0,0"
VerticalAlignment="Center"
controls:FontSettings.Key="Body1"
Text="{Binding DisplayName}"
TextTrimming="CharacterEllipsis"
TextWrapping="WrapWithOverflow" />
</Grid>
</DataTemplate>
<DataTemplate x:Key="Document.DescriptionCellTemplate" DataType="{x:Type local:ArchiveItemViewModel}">
<TextBlock
Margin="8,0,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Center"
Text="{Binding DocumentDescription}"
TextTrimming="CharacterEllipsis"
TextWrapping="Wrap" />
</DataTemplate>
This works without problems:
After applying some highlighting.
Code from Syncfusion given a few years ealier where we had an incident
(but generally it works and the error also occurs if you just color the text/replace it with "test" strings)
e.g. just goes through the visual tree and gets all textblocks and colors them red and replaces the text
After highlighting (the rowindex and columnindex just to show the later error) it is also fine and gives the correct result:
BUT after scrolling up/down the content of the textblock changes "randomly":
We have already tried the solution mentioned in:
(overridding GridCellTextBoxRenderer or in our case GridCellTextBRenderer but to no avail)
Also changed the virtualization of the grid to false.
For completeness the visual tree:
Do you have any ideas/solutions for this behavior?