How to save full state page in wpf navigation application

I am building a WPF application using pages and a navigation service.
One of the pages accepts the object as a constructor

Sub New(ByVal o As Object)
    ' This call is required by the Windows Form Designer.
    InitializeComponent()

    ....

So, to go to it, I do

    Dim MyPage As New Page1(MyObject)
    MyBase.NavigationService.Navigate(MyPage)

The problem arises when I edit something on the page, and go back, and forward to MyPage the following error occurs:

 Cannot create object of type 'Page1'. CreateInstance failed, which can be 
 caused by not having a public default constructor for 'Page1'.  

What am I doing wrong?

+3
source share
1 answer

-, , "" "", . : KeepAlive :

<Page x:Class="..." KeepAlive="True">

, MSDN :

, ( , Navigate), .

, , , .

+5

Source: https://habr.com/ru/post/1708301/


All Articles