I have got main ViewModel which contains Collection of data. It updates from Store by event. I want to send this collection to another ViewModel, which will show this data in view. But i have no idea how to notify another View Model. Data aren't shown in view. I am sure that every bindings in XAML are correct.
In debag i see than in every step Collection contains correct items,
Main view Model:
public class OpenedFileViewModel : ViewModelBase
{
private DataGridStore _gridStore;
public FileDataListingViewModel FileDataListingViewModel { get; set; }
public ObservableCollection<ItemModel> ReadedItems => _gridStore?.ItemsCollection;
public OpenedFileViewModel(DataGridStore _gridStore)
{
_gridStore.CurrentItemsChanged += OnCurrentFileDataChanged; // event when data in gridStore changed
}
private void OnCurrentFileDataChanged()
{
OnPropertyChanged(nameof(ReadedItems));
FileDataListingViewModel = new FileDataListingViewModel(ReadedItems);
}
}
View Model which should show data:
public class FileDataListingViewModel : ViewModelBase
{
private ObservableCollection\<ItemModel\> \_itmes;
public ObservableCollection\<ItemModel\> Items
{
get
{
return _itmes;
}
set
{
_itmes = value;
OnPropertyChanged(nameof(Items));
}
}
public FileDataListingViewModel(ObservableCollection<ItemModel> items)
{
Items = items;
OnPropertyChanged(nameof(Items));
}
}