Binding ComboBox to Secondary Object

391 Views Asked by At

My page's data context is set to an Instance of a Project class and all of the other fields in the page are working properly. Each project has another class associated with it as a property. This represents data from another company that we are integrating into this page. I am attempting to bind to this sub object's TypeID property. Here is a sketch of the objects.

public class Project
{
    public int Id { get; set; }
    public string ProjectName { get; set; }
    public ABCProject ABCProject { get; set; }
}

public class ABCProject
{
    public int Id { get; set; }
    public int ABCProjectTypeId { get; set; }
    public ABCProjectType { get; set; }
}

public class ABCProjectType
{
   public int ProjectTypeId { get; set; }
   public string TypeName { get; set; }
}

Here is what my XAML looks like:

<telerik:RadComboBox Grid.Column="2" Grid.Row="1" telerik:StyleManager.Theme="Metro" x:Name="ProjectTypeCombo"
                                 ItemsSource="{Binding ProjectTypePickList}"
                                 SelectedValue="{Binding ABCProject.ABCProjectTypeId, Mode=TwoWay}"
                                 SelectedValuePath="ABCProjectTypeId"
                                 DisplayMemberPath="TypeName"/>

The pick list is being bound properly. The issue is that the selected value and selected value path don't seem to be binding as I get a blank combobox when the page loads.

0

There are 0 best solutions below