I fiddled with the DataGrid headers and found something awkward. I played with him until I found the root cause in XAML and created a small sample of how to reproduce.
I tested this only with a text box and datagrid, but I suspect that it works with other controls as well. Setting the Margin property (I set Margin="2" ) either in the datagrid or in the text field, when their width is attached to the sibling element via ActualWidth , will cause all my Visual Studio to stop responding almost immediately.
<Window x:Class="MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindow" SizeToContent="WidthAndHeight"> <StackPanel Orientation="Vertical"> <StackPanel Orientation="Horizontal" x:Name="panel"> <TextBlock Text="Text:1" Width="90" /> <TextBox Width="90" /> </StackPanel> <DataGrid AutoGenerateColumns="False" Width="{Binding ActualWidth, ElementName=panel}"> <DataGrid.Columns> <DataGridTextColumn Header="Test" Width="*" /> <DataGridTextColumn Header="Test2" Width="*" /> <DataGridTextColumn Header="Test3" Width="*" /> </DataGrid.Columns> </DataGrid> <TextBox Width="{Binding ActualWidth, ElementName=panel}" /> </StackPanel> </Window>
This is a preview of the design before it stops responding. The window is stretched to "infinity" until I have no doubt that VS will run out of memory.

Any idea what could be causing this?
source share