Discovering open source WPF components – Orc.Wizard

In the discovering open source WPF components series, I will look into useful open source components that can be used to create WPF apps. This weeks component is Orc.Wizard.

A wizard is a great way to guide users through a process. Every wizard should behave the same, but there is no great out-of-the-box experience in WPF. The wizard included in this library has a few nice features:

  1. Automatic page management (with everything you expect from next / previous / finish, etc)
  2. Automatic (but optional) summary page that gathers all the information from each page to summarize what has been selected inside the wizard
  3. Optional pages that allow users to skip to a next page. It is also possible to enforce validation on a wizard page.
  4. Nice looking wizard header that is generated automatically based on the accent color

In summary, this library allows you to focus on the actual wizard content (the pages), not the wizard itself which is fully taken care of for you.

wizard

Creating wizard pages

A wizard page contains of three parts which are explained below.

Creating the wizard page model

The wizard model will hold all the information of the wizard page and return the summary (which is optional).

Creating the wizard page view model

The view model is responsible for the actual view logic. There can be a lot of stuff in here that is view-specific, as long as the results are stored into the model. This example uses the ViewModelToModel feature of Catel to automatically map the values between the view model and model. As you can see this example even contains validation, so users cannot continue to the next page when the validation does not succeed.

Creating the wizard page view

Below is the xaml view for the wizard page. Note that it’s just an ordinary Catel UserControl.

Creating the wizard

Once all the wizard pages have been created, it’s time to wrap it inside an actual wizard. Below is an example:

Using the wizard

Using the wizard can be done via the IWizardService. Below is an example on how to show a wizard:

Discovering open source WPF components – Orc.WorkspaceManagement

In the discovering open source WPF components series, I will look into useful open source components that can be used to create WPF apps. This weeks component is Orc.WorkspaceManagement.

Workspaces are a great way to empower your end-users to customize the layout of the screen to their own good. There are a lot of different components that can be customized inside an application (some views need settings to be stored, others should be ignored, etc). Orc.WorkspaceManagement provides a nice wrapper around this so whenever the user wants to store a workspace, each component can be stored separately using providers.

orc_workspacemanagement

Retrieving a list of workspaces

Retrieving the current workspace

Retrieving the currently selected workspace is very easy:

To get a typed instance:

Implementing providers

Providers are classes that do the hard work. They will take care of actually saving and loading the state of a specific workspace. Below is a provider that will store the IsMinimized state of a ribbon:

Storing and saving workspaces

The last step is storing workspaces and saving workspaces to disk. Since all the hard work is done by the IWorkspaceManager, it’s very easy to implement this final step.

Storing the workspace means the workspace manager will call all providers to gather their data so the UI state as it’s currently visible on the screen will be persisted into the current active workspace:

To save all workspaces in the workspace manager to disk, use the following code:

Discovering open source WPF components – Orc.Search

In the discovering open source WPF components series, I will look into useful open source components that can be used to create WPF apps. This weeks component is Orc.Search.

Most applications sooner or later need a search functionality. Since most .net applications work with models (objects containing the actual information users want to search for), it might be hard to implement such functionality.

A great open-source search engine for indexing and searching is Lucene.net, but it requires quite some work to implement it from scratch in an application. Orc.Search provides a great wrapper around Lucene.net in 3 simple steps. Of course it also comes with xaml controls to easily add search boxes with status indicators to your applications.

Step 1: decorate your models with the right attributes

An alternative to using attributes is to implement a custom IMetadataProvider (you are never forced to only use attributes).

Step 2: Add the projects to the search service

Step 3: Use the Search method

Once the objects are indexed, you can easily use the search method to search for any values:

Enjoy your results!

orc_search