views:

13

answers:

0

I'm having an issue with data binding that doesn't seem logical!

I have a control that I have inherited from a custom base class:

<a:DataPanel x:Class="Sample.Controls.DataPanel2"
             x:Name="Panel2"
             xmlns:a="clr-namespace:Sample.Controls">
   <Grid>
   </Grid>
</a:DataPanel>

DataPanel is a class that I've inherited from UserControl and has some data elements and event definitions. In this class, DataPanel2, I've added another data element:

public ObservableCollection<ItemElement> ComboItems { get; set; }

Using this collection, I'm attempting to bind the collection to a control in DataPanel2:

<ComboBox ItemsSource="{Binding Path=ComboItems, ElementName=Panel2}"
          DisplayMemberPath="Value" />

When I run the application and add data to the ComboItems collection, nothing appears in the ComboBox. When I use the designer to set the ItemsSource property, it says that ComboItems cannot be located in Panel2. When I browse for items, it will show me all the data elements in DataPanel, but nothing from DataPanel2.

Why is that? Is there some piece that I'm missing?