[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 620
  • Last Modified:

WPF Application page navigation

Hi Experts,
I am new to WPF (know windows forms) and still struggling with some of the basics. Please be kind and be very clear with your assistance.
I have created a main window and added a ribbon with buttons.
I now want to open (show) a page (window) based on button click.
On the page I want to get user input and return the values.
Very basic stuff in winforms. Not so easy in WPF (it seems)
I am using Visual Studio 2010 (Visual Basic)
0
esps
Asked:
esps
  • 4
  • 4
1 Solution
 
DmitryVasilievCommented:
Hello
You need to use "PageFunction" instead of "Page".
In this case you are able to get result using OnResult event of PageFunction.

See details here:
http://msdn.microsoft.com/en-us/library/ms615540.aspx
http://msdn.microsoft.com/en-us/library/aa349685.aspx
0
 
espsAuthor Commented:
Hi
Thank you for your response.

My code is as below, attached find error image:

Class MainWindow
Public ReadOnly Property NavigationService As NavigationService
        Get
        End Get
End Property

Private Sub RibbonButton3_Click(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs) Handles RibbonButton3.Click
        Dim pageFunctionUri As New Uri("SetupCriteria.xaml", UriKind.Relative)
        Me.NavigationService.Navigate(pageFunctionUri)
    End Sub
End Class
Capture.PNG
0
 
DmitryVasilievCommented:
Use NavigationPage instance as "Navigate" function parameter instead of Uri

Something like

Dim page as New SetupCriteria();
page.OnResult += ResultHandlerFunction;
Me.NavigationService.Navigate(page);
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
espsAuthor Commented:
Forgive my 'blondness'
I am not winning with the syntax (or something)

Private Sub RibbonButton3_Click(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs) Handles RibbonButton3.Click
        Dim page As New SetupCriteria()
        page.OnResult += ResultHandlerFunction
        Me.NavigationService.Navigate(page)
        End Sub

Please see image
Untitled.jpg
0
 
DmitryVasilievCommented:
Did you define ResultHandlerFunction handler?
0
 
espsAuthor Commented:
I am sorry.
This is not helping me.
You are obviously at a different level with this.
Please show me step by step, give me examples or links with specific examples.
regards
0
 
espsAuthor Commented:
Hi
Thank you. This has put me on the right track.
I will be accepting your previous answer as solution.
Please won't you also have a look at a previous question of mine that I am not getting helpful responses on?
ID: 26417220
best regards
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 4
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now