Two Way data binding between a Combo Box and ListView

M

Monty M.

Does anyone know how to perform two way data binding between a combo
box and a listview.

The listview is bound to a dataset table in code:
Binding Bind = new Binding();
DataTable dt;
Field_LV.DataContext = dt;
Field_LV.SetBinding(ListView.ItemsSourceProperty, Bind);


The items are displayed through a Grid View in XAML:
<ListView>
<ListView.View>
<GridView>
<GridViewColumn DisplayMemberBinding="{Binding
Mode=TwoWay, Path=raw_data_type}" />
</GridView>
</ListView.View>
</ListView>


The combo box contains values for Raw Data Type in XAML:
<ComboBox>
SelectedValue="{Binding Mode=TwoWay,
Path=raw_data_type}"
</ComboBox>


In code, I want the Combo box Selection Changed event to automatically
update the listview.

Does anyone know how to implement this functionality?

Thank you!!!!
 
G

Guest

You could to use the binding context thingy.

Like so:

this.BindingContext[dt].Position = comboBox.selectedIndex;
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top