Class Wizard
Represents a control that can be used to process a collection of type WizardPage in a specific order.
Inheritance
Implements
Namespace: Sartorius.SAF.Presentation.Controls
Assembly: Sartorius.SAF.Presentation.Controls.dll
Syntax
public class Wizard : Control, IAnimatable, ISupportInitialize, IFrameworkInputElement, IInputElement, IQueryAmbient, IDisposable
Remarks
The Wizard control does not provide navigation buttons. Furthermore it provides the commands BackCommand, NextCommand and CancelCommand as well as the captions BackCaption, NextCaption and CancelCaption which allow the user to create buttons on their own and bind to these properties.
The commands BackCommand, NextCommand and CancelCommand aggregate the corresponding logic of the CurrentPage command and the navigation method of the WizardPageSelector.
For example, if the next button is clicked by a user, the NextCommand of the CurrentPage (if set) is executed, and afterwards the Next() method of the WizardPageSelector is called. If the NextCommand of the CurrentPage reaches an invalid state, for example because a validation logic fails during command execution, an OperationCanceledException can be thrown to cancel the execution and prevent the wizard from calling the WizardPageSelector.Next method of the WizardPageSelector. If the logic of the NextCommand of the CurrentPage contains synchronous calls, the DataContext must implement the IWizardNavigation interface that contains an WizardNavigationStateChangedEventHandler which can be fired when the asynchronous calls have been finished.
The wizard contains a progress indicator that indicates which is the current wizard page, which pages have already been processed, and which pages still must be processed. The Visibility of this progress indicator can be changed by setting ProgressIndicatorVisibility to the appropriate state.
The wizard can also be used as a dialog. For a detailed description how to, please see the documentation of the WizardDialog.
Examples
This example illustrates how to use the Wizard control with two WizardPage.
<SAF:Wizard>
<SAF:WizardPage>
<TextBlock Text="Page 1" />
</SAF:WizardPage>
<SAF:WizardPage>
<TextBlock Text="Page 2" />
</SAF:WizardPage>
</SAF:Wizard>
This example illustrates how to use the Wizard without a progress indicator.
<SAF:Wizard ProgressIndicatorVisibility="Collapsed">
<SAF:WizardPage>
<TextBlock Text="Page 1" />
</SAF:WizardPage>
<SAF:WizardPage>
<TextBlock Text="Page 2" />
</SAF:WizardPage>
</SAF:Wizard>
This example illustrates how to use the Wizard, using its command and caption properties to create navigation buttons.
<StackPanel>
<!-- Create a wizard with two pages. Each page contains a simple TextBlock. -->
<SAF:Wizard x:Name="myWizard">
<SAF:WizardPage>
<TextBlock Text="Page 1" />
</SAF:WizardPage>
<SAF:WizardPage>
<TextBlock Text="Page 2" />
</SAF:WizardPage>
</SAF:Wizard>
<!-- Create buttons for 'Next', 'Back' and 'Cancel'. Bind the wizard commands and captions to the buttons. -->
<UniformGrid Rows="1">
<Button Content="{Binding ElementName=myWizard, Path=BackCaption}"
Command="{Binding ElementName=myWizard, Path=BackCommand}" />
<Button Content="{Binding ElementName=myWizard, Path=NextCaption}"
Command="{Binding ElementName=myWizard, Path=NextCommand}" />
<Button Content="{Binding ElementName=myWizard, Path=CancelCaption}"
Command="{Binding ElementName=myWizard, Path=CancelCommand}" />
</UniformGrid>
</StackPanel>
This example illustrates how to use the Wizard and bind a WizardPage specific NextCommand. The NextCommand is invoked before navigating to the next page.
<SAF:Wizard>
<SAF:WizardPage NextCommand="{Binding FirstPageNextCommand}">
<TextBlock Text="Page 1" />
</SAF:WizardPage>
<SAF:WizardPage>
<TextBlock Text="Page 2" />
</SAF:WizardPage>
</SAF:Wizard>
This example illustrates how to use the Wizard and cancel the execution of a bound WizardPage specific NextCommand.
<SAF:Wizard>
<SAF:WizardPage NextCommand="{Binding FirstPageNextCommand}">
<TextBlock Text="Page 1" />
</SAF:WizardPage>
<SAF:WizardPage>
<TextBlock Text="Page 2" />
</SAF:WizardPage>
</SAF:Wizard>
This example illustrates how to use the Wizard and set the navigation state within a bound WizardPage specific NextCommand that contains async calls, to notify the Wizard to navigate to the next page.
<SAF:Wizard>
<SAF:WizardPage NextCommand="{Binding FirstPageNextCommand}">
<TextBlock Text="Page 1" />
</SAF:WizardPage>
<SAF:WizardPage>
<TextBlock Text="Page 2" />
</SAF:WizardPage>
</SAF:Wizard>
Constructors
View SourceWizard()
Initializes a new instance of the Wizard class.
Declaration
public Wizard()
Fields
View SourceBackCaptionProperty
The DependencyProperty for the BackCaption property.
Declaration
public static readonly DependencyProperty BackCaptionProperty
Field Value
| Type | Description |
|---|---|
| DependencyProperty |
BackCommandProperty
The DependencyProperty for the BackCommand property.
Declaration
public static readonly DependencyProperty BackCommandProperty
Field Value
| Type | Description |
|---|---|
| DependencyProperty |
CancelCaptionProperty
The DependencyProperty for the CancelCaption property.
Declaration
public static readonly DependencyProperty CancelCaptionProperty
Field Value
| Type | Description |
|---|---|
| DependencyProperty |
CancelCommandProperty
The DependencyProperty for the CancelCommand property.
Declaration
public static readonly DependencyProperty CancelCommandProperty
Field Value
| Type | Description |
|---|---|
| DependencyProperty |
NextCaptionProperty
The DependencyProperty for the NextCaption property.
Declaration
public static readonly DependencyProperty NextCaptionProperty
Field Value
| Type | Description |
|---|---|
| DependencyProperty |
NextCommandProperty
The DependencyProperty for the NextCommand property.
Declaration
public static readonly DependencyProperty NextCommandProperty
Field Value
| Type | Description |
|---|---|
| DependencyProperty |
PagesProperty
The pages property
Declaration
public static readonly DependencyProperty PagesProperty
Field Value
| Type | Description |
|---|---|
| DependencyProperty |
ProgressIndicatorVisibilityProperty
The DependencyProperty for the ProgressIndicatorVisibility property.
Declaration
public static readonly DependencyProperty ProgressIndicatorVisibilityProperty
Field Value
| Type | Description |
|---|---|
| DependencyProperty |
SelectedPageIndexProperty
The selected page index property key
Declaration
public static readonly DependencyProperty SelectedPageIndexProperty
Field Value
| Type | Description |
|---|---|
| DependencyProperty |
Properties
View SourceBackCaption
Gets the back caption.
Declaration
public string BackCaption { get; }
Property Value
| Type | Description |
|---|---|
| string |
Remarks
This caption must be bound to a text element in xaml.
BackCommand
Gets the command to navigate to the previous WizardPage.
Declaration
public DelegateCommand BackCommand { get; }
Property Value
| Type | Description |
|---|---|
| DelegateCommand |
Remarks
This command must be bound to a Button in xaml.
CancelCaption
Gets the cancel caption.
Declaration
public string CancelCaption { get; }
Property Value
| Type | Description |
|---|---|
| string |
Remarks
This caption must be bound to a text element in xaml.
CancelCommand
Gets the command to cancel the wizard.
Declaration
public DelegateCommand CancelCommand { get; }
Property Value
| Type | Description |
|---|---|
| DelegateCommand |
Remarks
This command must be bound to a Button in xaml.
CurrentPage
Gets or sets the current page.
Declaration
public WizardPage CurrentPage { get; set; }
Property Value
| Type | Description |
|---|---|
| WizardPage |
NextCaption
Gets the next caption.
Declaration
public string NextCaption { get; }
Property Value
| Type | Description |
|---|---|
| string |
Remarks
This caption must be bound to a text element in xaml.
NextCommand
Gets the command to navigate to the next WizardPage.
Declaration
public DelegateCommand NextCommand { get; }
Property Value
| Type | Description |
|---|---|
| DelegateCommand |
Remarks
This command must be bound to a Button in xaml.
Pages
Gets or sets the wizard pages.
Declaration
[SuppressMessage("Usage", "CA2227:Collection properties should be read only", Justification = "Can be used as dependency property in Xaml.")]
public ObservableCollection<WizardPage> Pages { get; set; }
Property Value
| Type | Description |
|---|---|
| ObservableCollection<WizardPage> | The wizard pages. |
Remarks
WARNING: Changing the Collection after it was initially created/filled is currently not supported!!!
ProgressIndicatorVisibility
Gets or sets the Visibility of the progress indicator.
Declaration
public Visibility ProgressIndicatorVisibility { get; set; }
Property Value
| Type | Description |
|---|---|
| Visibility |
SelectedPageIndex
Gets the index of the selected page.
Declaration
public int SelectedPageIndex { get; }
Property Value
| Type | Description |
|---|---|
| int | The index of the selected page. |
WizardPageSelector
Gets or sets the page selector.
Declaration
public WizardPageSelector WizardPageSelector { get; }
Property Value
| Type | Description |
|---|---|
| WizardPageSelector |
Methods
View SourceDispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Declaration
public void Dispose()
Dispose(bool)
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Declaration
protected virtual void Dispose(bool disposing)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | disposing | Indicates disposing. |
OnApplyTemplate()
When overridden in a derived class, is invoked whenever application code or internal processes call ApplyTemplate().
Declaration
public override void OnApplyTemplate()