By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,695 Members | 1,284 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,695 IT Pros & Developers. It's quick & easy.

Two Way data binding between a Combo Box and ListView

P: n/a
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!!!!

May 31 '07 #1
Share this Question
Share on Google+
1 Reply


P: n/a

You could to use the binding context thingy.

Like so:

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

"Monty M." wrote:
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!!!!

May 31 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.