none
How to transfer data from One ViewModel to another in Caliburn Micro (WPF, MVVM) RRS feed

  • Вопрос

  • I have an authorization window where i identify User. Then, i want to transfer this object to another ViewModel where i will work with it;

    Example: 

    StudentMainWindowView student_window = new StudentMainWindowView(); // My "another" ViewModel, 
    student_window.Show();
    this.TryClose();

    What i want to do: 

    StudentMainWindowView student_window = new StudentMainWindowView(user_object); //"user_object" is a class with some data with one i want to work in StudentMainWindowView

     
    student_window.Show();
    this.TryClose();

    16 августа 2019 г. 15:49

Ответы

Все ответы

  • Hi,

    I don't know how it work on Caliburn Micro, but I know that for this operation in PRISM framework I can use EventAggregator (PubSub pattern). Is there something like that in the Caliburn Micro?


    Calabonga

    17 августа 2019 г. 1:35
  •     StudentMainWindowView student_window = new StudentMainWindowView();
                            student_window.DataContext = new StudentMainWindowViewModel();
                            ((StudentMainWindowViewModel)student_window.DataContext).UserData = list_users[i];
                            student_window.Show();
                            this.TryClose();

    Working without EventAggregator :D

    23 августа 2019 г. 17:54