-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Open
Labels
InvestigateRequires further investigation by the WPF team.Requires further investigation by the WPF team.
Description
Description
In a data grid setup with
<DataGridTemplateColumn Header="Crash" IsReadOnly="True">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock>
<Run Text="{Binding SomeValue}" />
</TextBlock>
</DataTemplate>
</DataGridTemplateColumn>
This crashes when I edit the text column and then cancel it with ESC.
The Exception is thrown in VisualTreeUtils.EnsureVisual, with text '{0}' is not a Visual or Visual3D.
Reproduction Steps
Create a WPF application for .NET Framework 4.8
Put a Datagrid on the window, and add the template column shown above
Expected behavior
Does not throw an exception
Actual behavior
Throws an exception
Regression?
No response
Known Workarounds
If you add to the binding a Mode=OneWay specification, the crash does not occur
Impact
Need to find the workaround and apply it in code, adding unnecessary complexity.
Configuration
Windows 10, fully updated February 2023, .NET Framework 4.8.1
Other information
When restoring information, the code seems to go through the bindings, and assumes that all are bound to a Visual. But a Run is not a visual.
Metadata
Metadata
Assignees
Labels
InvestigateRequires further investigation by the WPF team.Requires further investigation by the WPF team.