Help with an MVVM view

0

I'm reading the this tutorial on MVVM. But I do not understand the following:

<Window x:Class = "MVVMDemo.MainWindow"
   xmlns = "http://schemas.microsoft.com/winfx/2006/xaml/presentation"
   xmlns:x = "http://schemas.microsoft.com/winfx/2006/xaml"
   xmlns:d = "http://schemas.microsoft.com/expression/blend/2008"
   xmlns:mc = "http://schemas.openxmlformats.org/markup-compatibility/2006"
   xmlns:local = "clr-namespace:MVVMDemo"
   xmlns:views = "clr-namespace:MVVMDemo.Views"
   mc:Ignorable = "d"
   Title = "MainWindow" Height = "350" Width = "525">

   <Grid>
      <views:StudentView x:Name = "StudentViewControl" Loaded = "StudentViewControl_Loaded"/>
   </Grid>

</Window>
using System.Windows;

namespace MVVMDemo {

   /// <summary>
      /// Interaction logic for MainWindow.xaml
   /// </summary>

   public partial class MainWindow : Window {

      public MainWindow() {
         InitializeComponent();
      }

      private void StudentViewControl_Loaded(object sender, RoutedEventArgs e) {
         MVVMDemo.ViewModel.StudentViewModel studentViewModelObject = 
            new MVVMDemo.ViewModel.StudentViewModel();
         studentViewModelObject.LoadStudents();

         StudentViewControl.DataContext = studentViewModelObject;
      }
   }
}

Question:

At what time and where was the class StudentViewControl created which has the DataContext property changed in the last line of the StudentViewControl_Loaded method?

    
asked by anonymous 06.12.2016 / 11:52

1 answer

2

If you look at the project used by the tutorial, you will see that there is a ViewModel with the name of StudentViewModel and a UserControl which is View named StudentView . StudentViewControl is only the name that he assigned to the view he is using ... In the tutorial is Step 6     

06.12.2016 / 11:58