PageFunction OnReturn and the Default PageFunction Constructor

641 views Asked by At

I'm trying to create a Wizard at runtime in VB.NET using the WPF NavigationService and I'm having some problems.

I need to add controls to the PageFunction pages at runtime which seems to involve passing arguments to the PageFunction pages when I create them (prior to navigating to them). This means that the PageFunction pages need to override the default constructor and add arguments to it. This seems to work fine.

The problem is that I also need to call OnReturn once I've navigated beyond the first page (to go back to a previous page) but the OnReturn doesn't work unless I use the default constructor on the PageFunction page it is navigating back to.

The work around I've been considering is creating some global values that the PageFunctions could acssess at runtime in their default constructor but I can't figure out how to define global variables in the MainWindow that the PageFunction pages can get access to.

Any tips or suggestions would be appretiated!

Thanks Mike

p.s. I can also post my code if that will help.

1

There are 1 answers

0
zzMzz On BEST ANSWER

Since posting my question I discovered that if I set KeepAlive = True on the first PageFunction it solves my problem above