im trying to bind an observable collection(keyframes) located in the elements of my listbox to my datatemplate's itemssource(observable collection)
<ListBox x:Name="lbTimeLines"
DataContext="{Binding MainViewport,Source={StaticResource Locator}}"
ItemsSource="{Binding AnimateableObjects}" SelectedIndex="{Binding selectedIndex}">
<ListBox.ItemTemplate >
<DataTemplate DataType="{x:Type obj:ObjectSettings }">
<cc:TimeLine x:Name="TL" Height="25"
ItemsSource="{Binding Path=KeyFrames}"<!-- here is the problem -->
CurrentFrame="{Binding LayerView.CurrentFrame,Source={StaticResource Locator},Mode=TwoWay}"
Width="{Binding LayerView.Globalwidth,Source={StaticResource Locator}}">
</cc:TimeLine>
</DataTemplate>
</ListBox.ItemTemplate>
however this seems to result in the error
System.Windows.Data Error: 40 : BindingExpression path error: 'KeyFrames' property not found on 'object' ''TimeLineViewModel' (HashCode=2312607)'. BindingExpression:Path=KeyFrames; DataItem='TimeLineViewModel' (HashCode=2312607); target element is 'TimeLine' (Name='MainControl'); target property is 'ItemsSource' (type 'ObservableCollection`1')
not shure why but he seems to be looking for KeyFrames in the TimeLine's viewmodel instead of the listbox elements
note: i'm using similar binding on a different listbox, this however seems to work fine
<ListBox x:Name="lbLayers"
DataContext="{Binding MainViewport,Source={StaticResource Locator}}"
ItemsSource="{Binding AnimateableObjects}" SelectedIndex="{Binding selectedIndex}">
<ListBox.ItemTemplate>
<DataTemplate DataType="{x:Type obj:ObjectSettings }">
<StackPanel >
<Label Content="{Binding Name}" Height="25" Width="180"></Label>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>