Quantcast
Viewing all articles
Browse latest Browse all 256

[RESOLVED] MVVM: Populate a view (with listbox) when an item from another view (with listbox) is

I have a list of Topics, and for each topic there are some Examples. What I want to be able to do is that when a topic is selected then I will populate another view with all Examples for that selected topic. I'm still learning MVVM so not sure how to implement such.

This is what I've got so far but I haven't figured out yet how to receive/set the _exampleViewModel via binding in XAML.
Code:

public TopicViewModel SelectedTopic
    {
        get { return _selectedTopic; }
        set
        {
            _selectedTopic = value;
            OnPropertyChanged("SelectedTopic");

            //refresh list of exercises
            if (_exampleViewModel != null)
            {
                _exampleViewModel.RefreshExercises(_selectedTopic.ID);
            }
        }
    }


Viewing all articles
Browse latest Browse all 256

Trending Articles