Wizard Dialog Example for Blazor

Nevron NOV UserInterface for Blazor ships with hundreds of examples with full source code, as part of the Nevron Open Vision Suite. All Blazor UserInterface examples are also available as a stand-alone Visual Studio solution in C#, which you can download from the links below.

Wizard Dialog Example for Blazor Description

This example demonstrates how to use the NWizardDialog.

The NWizardDialog dialog consists of pages, each having an optional header and content.

The user is able to navigate through the pages via the Back and Next button.

When the user reaches the last page, the Finish button is enabled.

The NWizardDialog allows for many modifications including wizards with multiple paths, like the wizard displaed by the 'Show Dynamic Wizzard' button.


Wizard Dialog Example

C# Wizard Dialog Example Code for Nevron UserInterface for Blazor
Language: C#

using Nevron.Nov;
using Nevron.Nov.DataStructures;
using Nevron.Nov.Dom;
using Nevron.Nov.Graphics;
using Nevron.Nov.Layout;
using Nevron.Nov.UI;
using Nevron.Nov.Windows.Forms;
using System;
using System.Windows.Forms;

namespace NovWinFormsProject
{
	public partial class Form1 : Form
	{
		#region Constructors

		public Form1()
		{
			InitializeComponent();

			// Set form title
			Text = "NOV WinForms - NWizardDialogExample";

			// Create the NOV example and its controls
			NWidget exampleContent = CreateExampleContent();
			NWidget exampleControls = CreateExampleControls();
			if (exampleControls != null)
			{
				exampleControls.PreferredWidth = 300;
			}

			// Place the example and its controls in a pair box
			NPairBox pairBox = new NPairBox(exampleContent, exampleControls);
			pairBox.FillMode = ENStackFillMode.First;
			pairBox.FitMode = ENStackFitMode.First;
			pairBox.Margins = new NMargins(NDesign.HorizontalSpacing, NDesign.VerticalSpacing);

			// Host the example in the form
			NNovWidgetHost host = new NNovWidgetHost(pairBox);
			host.Dock = DockStyle.Fill;
			Controls.Add(host);
		}

		#endregion

		#region Example

		public NWidget CreateExampleContent()
		{
			NStackPanel stack = new NStackPanel();
			stack.Padding = new NMargins(10);
			stack.HorizontalPlacement = ENHorizontalPlacement.Left;
			

            NButton showSimpleWizard = new NButton("Show Simple Wizzard...");
			showSimpleWizard.Click += OnShowWizzardClick;
			stack.Add(showSimpleWizard);

            NButton showDynamicWizard = new NButton("Show Dynamic Wizzard...");
            showDynamicWizard.Click += OnShowDynamicWizardClick;
            stack.Add(showDynamicWizard);

            return stack;
		}
		public NWidget CreateExampleControls()
		{
			NStackPanel stack = new NStackPanel();
            stack.FillMode = ENStackFillMode.Last;

            // create the events list box
            m_EventsLog = new NExampleEventsLog();
            stack.Add(m_EventsLog);

            return stack;
		}
		public string GetExampleDescription()
		{
			return @"

This example demonstrates how to use the NWizardDialog.

The NWizardDialog dialog consists of pages, each having an optional header and content.

The user is able to navigate through the pages via the Back and Next button.

When the user reaches the last page, the Finish button is enabled.

The NWizardDialog allows for many modifications including wizards with multiple paths, like the wizard displaed by the 'Show Dynamic Wizzard' button.

"; } /// /// Gets the relevant documentation links for the example /// /// public (string Name, string Url)[] GetDocumentationUrls() { return new[] { ("Top Level Windows", "https://www.nevron.com/docs/openvision/ui-top-level-windows.html"), ("Containers Overview", "https://www.nevron.com/docs/openvision/ui-containers-overview.html"), }; } #endregion #region Implementation #endregion #region Event Handlers private void OnShowWizzardClick(NEventArgs arg) { NWizardDialog dialog = NApplication.CreateTopLevelWindow(); dialog.Title = "Simple Wizzard"; NWizardPage page1 = CreateSimplePage("Page 1", "I am the content of page 1"); NWizardPage page2 = CreateSimplePage("Page 2", "I am the content of page 2"); NWizardPage page3 = CreateSimplePage("Page 3", "I am the content of page 3"); dialog.Initialize(new NWizardPage[] { page1, page2, page3 }); dialog.CurrentPageIndexChanged += (args) => { m_EventsLog.LogEvent("Current Page Index changed to result: " + dialog.Result); }; dialog.Closed += (args) => { if (args.EventPhase != ENEventPhase.AtTarget) return; m_EventsLog.LogEvent("Wizard closed with result: " + dialog.Result); }; dialog.Open(); } private void OnShowDynamicWizardClick(NEventArgs arg) { NWizardDialog dialog = NApplication.CreateTopLevelWindow(); dialog.Title = "Dynamic Wizzard"; // create some simple pages // NOTE: page3 will be the last page in the wizard page collection, so it is naturally final // page 1 and page 2 need to be explicitly marked as final NWizardPage page1 = CreateSimplePage("Choice 1", "I am the content of choice 1"); page1.IsFinal = true; NWizardPage page2 = CreateSimplePage("Choice 2", "I am the content of choice 2"); page2.IsFinal = true; NWizardPage page3 = CreateSimplePage("Choice 3", "I am the content of choice 3"); // create a page from which the user chooses the next page. NRadioButtonGroup selectPathRadio = new NRadioButtonGroup(); NStackPanel stackPanel = new NStackPanel(); selectPathRadio.Content = stackPanel; NRadioButton radio1 = new NRadioButton("Choice 1"); stackPanel.Add(radio1); NRadioButton radio2 = new NRadioButton("Choice 2"); stackPanel.Add(radio2); NRadioButton radio3 = new NRadioButton("Choice 3"); stackPanel.Add(radio3); selectPathRadio.SelectedIndex = 0; NWizardPage choicePage = new NWizardPage("Choice Page"); choicePage.Title = "Choice Page"; choicePage.Content = selectPathRadio; choicePage.GetNextPageIndexDelegate = (theDialog) => { switch (selectPathRadio.SelectedIndex) { case 0: return Array.IndexOf(theDialog.Pages, page1); case 1: return Array.IndexOf(theDialog.Pages, page2); case 2: return Array.IndexOf(theDialog.Pages, page3); default: return -1; } }; dialog.Initialize(new NWizardPage[] { choicePage, page1, page2, page3 }); dialog.CurrentPageIndexChanged += (args) => { m_EventsLog.LogEvent("Current Page Index changed to result: " + dialog.Result); }; dialog.Closed += (args) => { if (args.EventPhase != ENEventPhase.AtTarget) return; m_EventsLog.LogEvent("Wizard closed with result: " + dialog.Result); }; dialog.Open(); } private NWizardPage CreateSimplePage(string title, string content) { NWizardPage page = new NWizardPage(); page.MinSize = new NSize(300, 200); page.Header.Content = new NLabel(title); page.Content = new NLabel(content); page.Title = title; return page; } #endregion #region Fields // Controls private NExampleEventsLog m_EventsLog; #endregion #region Static Methods #endregion #region Constants #endregion #region Nested Types #endregion } }

Download a fully functional C# (.cs) Wizard Dialog Example for Blazor Solution

Related Documentation Links