I have a view (MainPage.xaml) which is bound to a ViewModel. In the ViewModel I have a DataModel property (note that both viewmodel & datamodel implements INotifyPropertyChanged, or what that interface is called).
In my view i have defined an ItemsControl whose ItemsSource is bound to the said property. This property (DataModel) has an ObservableCollection (which i know it populated with valid data).
The xaml snippet looks like this:
<ItemsControl ItemsSource="{Binding Path=CurrentDataModel.Items}">
Note that i am not showing the rest of the xaml. All it shows is the ItemsTemplate which is just a TextBlock.
The issue is that nothing is being drawn for this ItemsControl, even though i can clearly see (while debugging) that the collection has good data.
Is this "Path=..." binding not possible for an ItemsControl's ItemsSource?
The Path syntax looks correct. The most likely cause of failure is that either the DataContext
is not set to your ViewModel
or that the property path you specified is incorrect.
In your question you state that the ViewModel
has a property named DataModel but in the xaml snippet you have CurrentDataModel
.