Q:

How to bind List Data to combobox

I mae a WCF service that contain this method :
public List<LocationDB> GetLocation()
{
    List<LocationDB> locations = null;
    using (SqlConnection connection = new SqlConnection(conn))
    {
        using (SqlCommand command = new SqlCommand())
        {
            command.Connection = connection;
            command.CommandText = string.Format("Select L_ID ,L_Name from Location");
            connection.Open();
//code to fill the locations list..

my problem is when i want to bind the result from this method in  my code i do the following.
 void MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
    {
            client.GetLocationCompleted += new EventHandler<GetLocationCompletedEventArgs>(client_GetLocationCompleted);
            client.GetLocationAsync();
        }
    }

and :
void client_GetLocationCompleted(object sender, GetLocationCompletedEventArgs e)
    {
        LocationCombo.ItemsSource = e.Result;
        LocationCombo.SelectedValuePath = 
        LocationCombo.DisplayMemberPath =
    }

and finally my LocationDB Class that is located in the App_code folder in the asp web site:
     [DataContract]
public class LocationDB
{
    [DataMember]
    public int Lid { get; set; }
[DataMember]
public int SmId { get; set; }

[DataMember]
public string Lname { get; set; }

how can i bind the SelectedValePath and the DisplayMemberPath in code behind not in XAML.
Thanks

A:

From what I can tell you already have everything you need although some of it needs to be in a different order.
void client_GetLocationCompleted(object sender, GetLocationCompletedEventArgs e)
{
    LocationCombo.SelectedValuePath = "Lid";
    LocationCombo.DisplayMemberPath = "Lname";
    LocationCombo.ItemsSource = e.Result;
}

