I got a combobox in the grid’s column:
<ListView>
<ListView.View>
<GridView>
<GridViewColumn>
<GridViewColumn.CellTemplate>
<DataTemplate>
<ComboBox />
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
Now, in the SelectionChanged() of ComboBox I’m trying to change some value in an other column but the same row. And I can’t find how to get the current row.
none of the following doesn’t work
ListView.Items.CurrentPosition
ListView.Items.CurrentItem
please guys help me
You should try to avoid accessing the controls directly. Bindings in WPF are pretty powerful and should cover all cases. However if you really want to navigate through the hierarchy of controls you could use VisualTreeHelper.
VisualTreeHelperhas lots of methods to transverse the tree of nested controls. In your caseVisualTreeHelper.GetParent(comboBoxInstance)is the one you are looking for.