I have a beginner's question on Scope. In the MainWindow class I've created an instance of the ModelView class for data binding, and an instance of the Cabbage class which has the Leaves property I want to display. My question is how do I refer to myCabbage.Leaves from the updateCabbageLeaves method?
namespace TestScope
{
public partial class MainWindow : Window
{
    public MainWindow()
    {
        InitializeComponent();
        ModelView myModelView = new ModelView();
        Cabbage myCabbage = new Cabbage();
        myCabbage.Leaves = 99;
        myModelView.updateCabbageLeaves();
    }
}
class ModelView
{
    public int CabbageLeaves { get; set; }
    public void updateCabbageLeaves()
    {
        //CabbageLeaves = myCabbage.Leaves;
    }
}
class Cabbage
{
    public int Leaves { get; set; }
}
}
I guess this is not the way to set up a MVVM. My reasoning is: for a MVVM I need a class for the model and a class for the model view. The application starts in the MainWindow class so I've created instances of the model and the model view classes there.
I'm fairly new to C#. Thanks for any help.
James
 
     
    