472,799 Members | 1,337 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,799 software developers and data experts.

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 9674

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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: kk | last post by:
Have 2 problems, any help is appreciated. Tab with Grids -------------- BL - fetching data from DB ( 5 secs - 10 rows) Grid Laod - 20 secs Grid Paint on tab change - 20 secs Problem: The...
3
by: alan | last post by:
What I would like to do is like that, a ListView data binding with a dataset which list all records of a table( for example the table list all the information of a student student_id, name,...
2
by: SoftWhiteDelgiht | last post by:
Help me. I am obviously stupid! :-) I am just starting out with VB.Net and am trying to do a simple master/detail form with a SqlServer backend. I have created a combo box which is to populate with...
0
by: Larry Serflaten | last post by:
I am not sure how many are aware of this sort of data binding, but as it is new to many (classic) VB developers I thought I would post this once just to let people know of its availablility. ...
4
by: emzyme20 | last post by:
Hi, I am trying to populate a list control that is bound to a data table but the display member needs to come from a different data table. I have two list controls in C#, one displaying...
0
by: Monty M. | last post by:
Does anyone know how to perform two way data binding between a combo box and a listview. The listview is bound to a dataset in code: Binding Bind = new Binding(); Field_LV.DataContext = dt;...
3
by: Max | last post by:
Hello, I made a windows form with a combo box and 4 text boxes. All 5 objects should get their data from a data set which is populated in the form load method. The combo box has item ids. When...
3
by: csharpula csharp | last post by:
Hello, I am trying to do data binding with c# Binding - trying to bind list<objectto a list view. Is there any code example for doing that? Thank you! *** Sent via Developersdex...
7
by: Brad Pears | last post by:
I have something strange going on - pretty sure it used to work before - and now it does not... Why does the following code not clear a combo box? Me.cboLocation.Text = String.Empty OR ...
0
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Sept 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: lllomh | last post by:
How does React native implement an English player?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.