Transferring data from one page to another page WPF VB.Net

I have two open pages WPFand I want to send "textbox3.text" from page2 to "textbox1.text" in Page1

in vb, which is easy:

page1.textbox1.text = texbox3.text

but I can’t find out how to do this in WPF

+3
source share
1 answer

I think that you can create a property in Page1 that contains the value that is in the TextBox

Public ReadOnly Property TextBox1Value() As String
    Get
        Return theFirstTextBox.Text
    End Get
End Property

And get this value and pass it to Page2 in the constructor, for example

Public Sub New(ByVal value As String)

    ' This call is required by the Windows Form Designer.
    InitializeComponent()

    ' Add any initialization after the InitializeComponent() call.
    theSecondTextBox.Text = value
End Sub

Private Sub CreatePage2Method()
    Dim page As Page2 = New Page2("BlaBlaBla")
    NavigationService.Navigate(page)
End Sub

Good luck

+1
source

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


All Articles