I have a GridView
whith DataGridComboBoxColumn
, it works fine the first time, but when set the column visibility
to collapsed
, and then return the visibility
to visible
again, the column lose its value. but the property which is bounded to it still has the correct value.
when refresh the DataContext all the values gets binded correctly.
I add a test Converter, and noticed that when collapsing the column, the call back method is fired, and the value is null.
<DataGridComboBoxColumn SelectedValueBinding="{Binding DbId}"
DisplayMemberPath="Name"
SelectedValuePath="Id"
Visibility="Visible">
<DataGridComboBoxColumn.ElementStyle>
<Style TargetType="ComboBox">
<Setter Property="ItemsSource" Value="{Binding TestList}"/>
</Style>
</DataGridComboBoxColumn.ElementStyle>
<DataGridComboBoxColumn.EditingElementStyle>
<Style TargetType="ComboBox">
<Setter Property="ItemsSource" Value="{Binding TestList}"/>
</Style>
</DataGridComboBoxColumn.EditingElementStyle>
</DataGridComboBoxColumn>