After a lot of trial and errors, I got the right steps to bind a ComboBox to my collection class. Given below are the steps for anyone out there looking for a solution.
1. Set the ItemsSource property to the collection
2. Set the DataContext property to the collection
3. Set the DisplayMemberPath property to the name of a field in the collection.
4. Set the SelectedValuePath property to the name of a field in the collection.
this.cmbProjects.ItemsSource = Globals.AllProjects.Collection;
this.cmbProjects.DataContext = Globals.AllProjects.Collection;
this.cmbProjects.DisplayMemberPath = "Name";
this.cmbProjects.SelectedValuePath = "Name";
Subscribe to:
Post Comments (Atom)
What is success?
The journey of life takes us through varied experiences like landing an admission at a prestigious college, earning a degree, getting hired,...
-
Recently after a domain password change, I got the following error in trying to run the webrole. Can not log on locally to WebRole as us...
-
I was trying my hands at creating a .NET 2.0 component that can be consumed by a COM application. One of the errors I got in the process of...
-
After editing the post-build event of my project in VS 2005, the following error came up "'Exec' task needs a command to execut...
No comments:
Post a Comment