I have two datagrids with one column each.
First:
<DataGrid.Columns>
<DataGridTextColumn x:Name="FilterTextCol01"
IsReadOnly="False"
Width="{Binding ElementName=TextCol01, Path=ActualWidth, Mode=TwoWay}" />
</DataGrid.Columns>
Second:
<DataGridTextColumn CellStyle="{StaticResource DataGridColumnContentLeft}"
local:DataGridUtil.Name="TextCol01"
x:Name="TextCol01"
Header="TextCol01"
SortMemberPath="TextCol01"
Binding="{Binding TextCol01}"
Width="Auto"
IsReadOnly="True"/>
Binding of the width of first column to the width of the second doesn't work.
If I'm doing it in code that way:
FilterTextCol01.Width = TextCol01.ActualWidth;
It works.
Could anyone tell me why the first approach doesn't work?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…