Click here to Skip to main content
15,886,110 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more: , +
I am trying to bind profile from the list of collectorDTO to Combobox in wpf from list of data, Please find the code below
HTML
List<CollectorDTO> cdlist = new List<CollectorDTO>();
cbProfile.ItemsSource = cdlist;
cbProfile.DisplayMemberPath = "Profile";            
cbProfile.SelectedValuePath = "Profile";

Collector DTO contains the following variables with get set method
C#
private  int _coldataId;
private string _profile;
private string _protocol;
private string _hosttype;
private string _host;
private string _uid;
private string _pwd;
private string _remdir;
private string _locdir;
private string _database;
private string _audittrail;
private string _skeleton;
private string _tmode;
private string _cmdstr;
private string _starttime;
private string _stoptime;
private int _period;
private string _addinfo;
Posted
Updated 26-Feb-13 5:17am
v2
Comments
Steve Maier 26-Feb-13 11:22am    
And your question is??

1 solution

Sandeep,

From what I gather you are declaring cdlist as a newly instanciated variable, but you are not filling it in with any data. Instead you are binding an empty list to your combobox. You need to add a method that returns you a list of ColectorDTO objects. Something like..
C#
cdlist = GetCollectors();


where the function GetCollectors returns a list of CollectorDTO objects it has retrieved from some source of data.
 
Share this answer
 
Comments
Badshah78652 27-Feb-13 6:13am    
I have already loaded the data in cdlist but not able to bind that to the combobox

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900