Xaml: Data Binding Two Controls To One Source
-
Hello All, I'm running into a problem and I was wondering if anyone could help me out. I'm trying to data bind two combo boxes to one data table. I've got it to work, however when I change the selection of one combo box, the other one changes as well. I've seen a lot of documentation on how to solve this problem in the 2.0 framework, however, I've not seen any help on this topic so far. I would like it so that the changes between the combo boxes are independant of each other (i.e. combobox1 can select item 1, and combobox2 can select item 2) Here is my code... C#=================================================== ...In the my Page object's .xaml.cs file... DataTable table = new DataTable("table1"); DataColumn lName = new DataColumn("FullName", typeof(string)); table.Columns.Add(lName); //Add Column to Table //Create Row DataRow r1 = table.NewRow(); //Fill Data For Row r1["FullName"] = "smith, joe"; table.Rows.Add(r1); DataContext = table; //set the Page object's Data Context to the Data Table Xaml================================================== ===================================================== Thank you in advance for your time. Also, I didn't know if this was the right forum to post this, sorry if I was wrong! jm6k The Jazz Master 6000 DJ Badknees Parma Grind Crew - www.geocities.com/parmagrindcrew
-
Hello All, I'm running into a problem and I was wondering if anyone could help me out. I'm trying to data bind two combo boxes to one data table. I've got it to work, however when I change the selection of one combo box, the other one changes as well. I've seen a lot of documentation on how to solve this problem in the 2.0 framework, however, I've not seen any help on this topic so far. I would like it so that the changes between the combo boxes are independant of each other (i.e. combobox1 can select item 1, and combobox2 can select item 2) Here is my code... C#=================================================== ...In the my Page object's .xaml.cs file... DataTable table = new DataTable("table1"); DataColumn lName = new DataColumn("FullName", typeof(string)); table.Columns.Add(lName); //Add Column to Table //Create Row DataRow r1 = table.NewRow(); //Fill Data For Row r1["FullName"] = "smith, joe"; table.Rows.Add(r1); DataContext = table; //set the Page object's Data Context to the Data Table Xaml================================================== ===================================================== Thank you in advance for your time. Also, I didn't know if this was the right forum to post this, sorry if I was wrong! jm6k The Jazz Master 6000 DJ Badknees Parma Grind Crew - www.geocities.com/parmagrindcrew