Friday 20 May 2011

Silverlight Wizard Custom Control for sharing

I created a lightweight Silverlight Wizard Custom Control, you can download the dll here:
I also provide a sample project showing you how to use the Wizard dll in your real project, you can download the demo project here:

You can view the live Demo here:

If you want to introduce this control to someone else, please reference my Blog post

Now I briefly introduce how to use this control,
First: you have to reference this Wizard.dll to your project;
Second: you have to host the Wizard in some container, either in a Child Window or just a User Control. I prefer Child Window.
I assuming you are hosting the Wizard in a Child Window

Third: add the following XML namespace: to the Child Window's XAML file:
xmlns:wizard="clr-namespace:Wizard;assembly=Wizard"

Delete the OK and Cancel button, rewrite the XAML codes like this and be careful the core parameters need to be set are
ImagePathUri
TitleText

<Grid x:Name="LayoutRoot" Margin="2">
<Grid.RowDefinitions>
<RowDefinition />
</Grid.RowDefinitions>
<wizard:ChunXuWizard
x:Name="createUserWizard"
Grid.Row="0"
Margin="0,-2,0,0"
ImagePathUri="/SilverlightApplication18;component/Images/people.png"
TitleText="Add a new student"
Loaded="createUserWizard_Loaded"
/>
</Grid>

please make sure the image /SilverlightApplication18;component/Images/people.png exist in the Image folder, otherwise Wizard will not show anything in the image block(it's not a big deal, isn't it?)

than in the code-behind event method ... you have to insert the pages which the Wizard would like to slide, I created 4 UserControls and I list the codes here:
ObservableCollection<Control> t = new ObservableCollection<Control>();
t.Add(new StudentDataInputBasicInfomation());
t.Add(new StudentDataInputBasicInfomation2());
t.Add(new StudentDataInputBasicInfomation3());
t.Add(new StudentDataInputBasicInfomation4());
this.createUserWizard.NormalControls = t;
Fourth, Create a new Child Window in your code and show the window, you can see the cool slide Wizard living in your screen, like these screen shot:

Click Next Button




The page will slide to the Next page, and by clicking the Back Button, you can go to previous page, the data will be kept.

Next time, I will introduce some detail of how to use the control.

Enjoy the silverlight

7 comments:

  1. Hi,

    this looks very nice!

    I have a few questions:

    How do you determine when the wizard has completed from the container eg childWindow?

    Will you publish the source and what's the licence? Thanks.

    ReplyDelete
  2. hi, EMT
    thanks for your Comments

    how to determine when the wizard should complete?

    very easy, when the current page is the last page, I assume the wizard should finish, so the Next button become an OK button

    When the user click "OK" button, I check the parent of the wizard(or the container of the Wizard), if the parent is a Child Window, I will execute the Close command.

    I don't want to publish the source now and I am going to improve the Wizard, there is still some bugs existing.

    the next version will be coming next month, and you will see a much powerful Wizard

    the licence? currently you can use it anywhere in your project, but not for Commercial Purpose

    ReplyDelete
  3. Thanks, Chun Xu. I'd like to use it commercially... What are my options?

    ReplyDelete
  4. Hi, EMT

    if you want to use this Wizard control for Commercial Purpose, you have to purchase the licence,

    100$ for full licence, use as it

    if you like, you can send me e_mail at
    xuchun9000@hotmail.com

    ReplyDelete
  5. This article is very Nice.
    But i am struggling to pass bind data to control for Page2,3 etc

    How can we pass Variables from one page to another page......

    Please help me

    ReplyDelete