Open
Description
- .NET Core Version: 5.0.6
- Windows version: 21H1 (Build 19043.928)
- Does the bug reproduce also in WPF for .NET Framework 4.8?: Yes
- Is this bug related specifically to tooling in Visual Studio (e.g. XAML Designer, Code editing, etc...)?: No
Problem description:
UIElement.Measure this very slow
Expected behavior:
Fast measuring for WPF rendering.
If there is nothing more that can be optimized in the measure method, it might make sense to cache the measures according to certain parameters, since this is very slow with large visual trees.
Compared to Windows Forms, Windows Forms is superior in terms of performance here.
Would it not make sense to write the measure method in native C++ somehow to optimize the performance accordingly or is the overhead here too large?
Minimal repro:
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<!-- ... Many column definitions -->
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Heigth="*"/>
<!-- ... Many row definitions -->
</Grid.RowDefinitions>
<Button Grid.Row="0" Grid.Column="0">Test</Button>
<Button Grid.Row="1" Grid.Column="0">Test</Button>
<Button Grid.Row="0" Grid.Column="2">Test</Button>
<Button Grid.Row="2" Grid.Column="3">Test</Button>
<Button Grid.Row="12" Grid.Column="0">Test</Button>
<Button Grid.Row="7" Grid.Column="8">Test</Button>
<!-- ... big visual tree -->
</Grid>