Hello everyone,
I am building my own implementation of a wizard style interface and struggling to get it working correctly, along with every other style of wizard interface I expect to encounter the same problem. See image:
http://img208.imageshack.us/img208/3857/wizardinwindow.jpg
http://yfrog.com/5swizardinwindowj
Basically I am using a grid and have my navigation elements below that. The grid will switch the screens, like so:
private void btnNext_Click(object sender, RoutedEventArgs e)
{
Wizard.Progress++;
SwitchUserControl();
}
private void SwitchUserControl()
{
switch (Wizard.Progress)
{
case 0:
contentGrid.Children.RemoveRange(0, contentGrid.Children.Count);
contentGrid.Children.Add(screen0);
break;
case 1:
contentGrid.Children.RemoveRange(0, contentGrid.Children.Count);
contentGrid.Children.Add(screen1);
break;
case 2:
contentGrid.Children.RemoveRange(0, contentGrid.Children.Count);
contentGrid.Children.Add(screen2);
break;
case 3:
contentGrid.Children.RemoveRange(0, contentGrid.Children.Count);
contentGrid.Children.Add(screen3);
break;
}
}
This is where I get to the problem:
That works fine to switch among the controls. The problem is, say for example on of the screens says enter a date. And I have some data validation code to run on that text field. If validation fails the textbox border goes red and a message appears. But now I don't know where this code can go. I used to have it on the button on the usercontrol screenX, but now my navigation buttons are below, and then if I want to put it on the code under those nav buttons, I can't access the textfield!
I also see this problem occuring in most implementations of wizard style interface. Most examples I see use check boxes or radio buttons so there is no error in data input. But that is not very helpful to this example.
So what are my options to achieve what I want here???
Thanks for vieiwing.