I want to bind SelectedItem
of the combo box with a value converter to DataGridTextColumn
after it. I am using MVVM pattern.
<Datagrid>
<DataGridTemplateColumn Header="Left">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<ComboBox Name="Leftcombo"
ItemsSource="{Binding Path=DataContext.Column, RelativeSource={RelativeSource AncestorType=Window}}"
SelectedItem="{Binding SelectedColumn, UpdateSourceTrigger=PropertyChanged}"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTextColumn Header="Right"
Binding="{Binding SelectedColumn, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}"/>
</DataGrid.Columns>
</DataGrid>
Please note: SelectedColumn
is a property in the ViewModel bound to SelectedItem
of the combo box.
Binding works the way it is in XAML above, but I want to use a value converter on the DataGridTextColumn Header="Right"
column.