How to pass values between two pages in WPF

后端 未结 4 1400
春和景丽
春和景丽 2021-01-02 08:41

what is the best practice to pass values between pages in WPF?

thanks

4条回答
  •  旧时难觅i
    2021-01-02 09:23

    same as Windows Forms:

    do not just use global variables or access page's controls from another page. if you have two pages which need to share the same object, e.g. Student, have a method like SetStudent(Student student) in your page or use a property so one page can pass the object Student using that method. You can also have the Get of course, if needed.

提交回复
热议问题