468,283 Members | 1,952 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,283 developers. It's quick & easy.

Two Way data binding between a Combo Box and ListView

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
1 9276

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.

Similar topics

2 posts views Thread by SoftWhiteDelgiht | last post: by
reply views Thread by Larry Serflaten | last post: by
3 posts views Thread by Max | last post: by
3 posts views Thread by csharpula csharp | last post: by
7 posts views Thread by Brad Pears | last post: by
reply views Thread by NPC403 | last post: by
reply views Thread by zattat | last post: by
2 posts views Thread by MrBee | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.