Hi there,
I'm puzzled suppose the reason is I come from the Window Forms old-fashioned world.
Well, my WPF application runs at first Main.XAML, it is a Window where I load later either windows or pages without problems. I mean, it works like MasterPage or MDI.
My aim would be from one XAML page call another page. It does not look rocket science but I'm trying to get the parent and then raise the event but it does not work at all:
In fact, I get the instance for my Main.XAML using:
System.Windows.Window.GetWindow(Me)
But then I am not able to call any event…
Main.XAML:
Public Sub opt1()
Me.MarcPrincipal.Visibility = Windows.Visibility.Visible
Me.MarcPrincipal.Source = New Uri("Page1.xaml", UriKind.RelativeOrAbsolute)
End Sub
Public Sub ProcesosClientes_Click(sender As Object, e As RoutedEventArgs) Handles ProcesosClientes.Click
Me.MarcPrincipal.Visibility = Windows.Visibility.Visible
Me.MarcPrincipal.Source = New Uri("Customers.xaml", UriKind.RelativeOrAbsolute)
End Sub
Page1.xaml:
'Get the parent
Dim finestretaAs System.Windows.Window = System.Windows.Window.GetWindow(Me)
finestreta =NewMain()
'Debug.Print finestreta.name
AddHandler finestreta.ProcesosClientes_Click,AddressOf naa
Error: ProcesosClientes is not an event of System.Windows.Window
How can I call ProcesosClientes_Click from my Page???
Thanks a lot for your thoughts or ideas,
Primary platform is Windows 7 Ultimate 64 bit along with VS 2012/Sql2k8 for WPF/SilverLight projects.