Solved

WPF Application page navigation

Posted on 2010-09-14
8
596 Views
Last Modified: 2013-11-12
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
Comment
Question by:esps
  • 4
  • 4
8 Comments
 
LVL 2

Expert Comment

by:DmitryVasiliev
ID: 33670565
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
 

Author Comment

by:esps
ID: 33672109
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
 
LVL 2

Expert Comment

by:DmitryVasiliev
ID: 33672440
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
Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

 

Author Comment

by:esps
ID: 33673989
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
 
LVL 2

Expert Comment

by:DmitryVasiliev
ID: 33674035
Did you define ResultHandlerFunction handler?
0
 

Author Comment

by:esps
ID: 33674956
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
 
LVL 2

Accepted Solution

by:
DmitryVasiliev earned 500 total points
ID: 33675086
0
 

Author Comment

by:esps
ID: 33679892
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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
For most people, the WrapPanel seems like a magic when they switch from WinForms to WPF. Most of us will think that the code that is used to write a control like that would be difficult. However, most of the work is done by the WPF engine, and the W…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question