Palette Example for WPF

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

Palette Example for WPF Description

This example demonstrates how to associate a palette with an indicator.


Indicator Palette Example

C# Palette Example Code for Nevron Gauge for WPF
Language: C#

using Nevron.Nov;
using Nevron.Nov.Chart;
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 - NIndicatorPaletteExample";

			// 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.HorizontalPlacement = ENHorizontalPlacement.Left;

			m_AxisRange = new NRange(80, 130);
			int indicatorCount = 4;
			m_IndicatorPhase = new double[indicatorCount];

			// create gauges
			CreateLinearGauge();
			CreateRadialGauge();

			// add to stack
			stack.Add(m_LinearGauge);
			stack.Add(m_RadialGauge);

			// add axes
			m_LinearGauge.Axes.Add(CreateGaugeAxis());
			m_RadialGauge.Axes.Add(CreateGaugeAxis());
			
			double offset = 10;

			// now add two indicators
			for (int i = 0; i < indicatorCount; i++)
			{
				m_IndicatorPhase[i] = i * 30;

				m_LinearGauge.Indicators.Add(CreateRangeIndicator(offset));
				offset += 20;
			}

			m_RadialGauge.Indicators.Add(CreateRangeIndicator(0));

			stack.Registered += OnStackRegistered;
			stack.Unregistered += OnStackUnregistered;

			return stack;
		}
		public NWidget CreateExampleControls()
        {
			NStackPanel stack = new NStackPanel();

			NStackPanel propertyStack = new NStackPanel();
			stack.Add(new NUniSizeBoxGroup(propertyStack));

			NButton toggleTimerButton = new NButton("Stop Timer");
			toggleTimerButton.Click += OnToggleTimerButtonClick;
			toggleTimerButton.Tag = 0;
			stack.Add(toggleTimerButton);

			NComboBox rangeIndicatorShapeCombo = new NComboBox();
			rangeIndicatorShapeCombo.Items.FillFromEnum();
			rangeIndicatorShapeCombo.SelectedIndexChanged += OnRangeIndicatorShapeComboSelectedIndexChanged;
			rangeIndicatorShapeCombo.SelectedIndex = (int)ENRangeIndicatorShape.Bar;
			stack.Add(NPairBox.Create("Shape:", rangeIndicatorShapeCombo));

            NComboBox paletteColorModeCombo = new NComboBox();
            paletteColorModeCombo.Items.FillFromEnum();
            paletteColorModeCombo.SelectedIndexChanged += OnPaletteColorModeComboSelectedIndexChanged;
            paletteColorModeCombo.SelectedIndex = (int)ENPaletteColorMode.Spread;
            stack.Add(NPairBox.Create("Palette Color Mode:", paletteColorModeCombo));
            
			NComboBox orientationCombo = new NComboBox();
			orientationCombo.Items.FillFromEnum();
			orientationCombo.SelectedIndexChanged += OnOrientationComboSelectedIndexChanged;
			orientationCombo.SelectedIndex = (int)ENLinearGaugeOrientation.Vertical;
			stack.Add(NPairBox.Create("Orientation", orientationCombo));

			NNumericUpDown beginAngleUpDown = new NNumericUpDown();
			beginAngleUpDown.Value = m_RadialGauge.BeginAngle.Value;
			beginAngleUpDown.ValueChanged += OnBeginAngleUpDownValueChanged;
			stack.Add(NPairBox.Create("Begin Angle:", beginAngleUpDown));

			NNumericUpDown sweepAngleUpDown = new NNumericUpDown();
			sweepAngleUpDown.Value = m_RadialGauge.BeginAngle.Value;
			sweepAngleUpDown.ValueChanged += OnSweepAngleUpDownValueChanged;
			stack.Add(NPairBox.Create("Sweep Angle:", sweepAngleUpDown));

			NCheckBox invertScaleCheckBox = new NCheckBox("Invert Scale");
			invertScaleCheckBox.CheckedChanged += OnInvertScaleCheckBoxCheckedChanged;
			invertScaleCheckBox.Checked = false;
			stack.Add(invertScaleCheckBox);

			NCheckBox smoothPaletteCheckBox = new NCheckBox("Smooth Palette");
			smoothPaletteCheckBox.CheckedChanged += OnSmoothPaletteCheckBoxCheckedChanged;
			smoothPaletteCheckBox.Checked = true;
			stack.Add(smoothPaletteCheckBox);

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

This example demonstrates how to associate a palette with an indicator.

"; } /// /// Gets the relevant documentation links for the example /// /// public (string Name, string Url)[] GetDocumentationUrls() { return new[] { ("Gauges Indicators Overview", "https://www.nevron.com/docs/openvision/gauges-indicators-overview.html"), ("Gauges Needle Indicator", "https://www.nevron.com/docs/openvision/gauges-needle-indicator.html"), ("Gauges Range Indicator", "https://www.nevron.com/docs/openvision/gauges-range-indicator.html"), }; } #endregion #region Implementation private void CreateRadialGauge() { m_RadialGauge = new NRadialGauge(); m_RadialGauge.PreferredSize = defaultRadialGaugeSize; m_RadialGauge.CapEffect = new NGelCapEffect(); m_RadialGauge.Border = CreateBorder(); m_RadialGauge.BorderThickness = new NMargins(6); m_RadialGauge.BackgroundFill = new NStockGradientFill(NColor.DarkGray, NColor.Black); m_RadialGauge.NeedleCap.Visible = false; m_RadialGauge.PreferredWidth = 200; m_RadialGauge.PreferredHeight = 200; m_RadialGauge.Padding = new NMargins(5); } private void CreateLinearGauge() { m_LinearGauge = new NLinearGauge(); m_LinearGauge.Orientation = ENLinearGaugeOrientation.Vertical; m_LinearGauge.PreferredWidth = 200; m_LinearGauge.PreferredHeight = 300; m_LinearGauge.CapEffect = new NGlassCapEffect(); m_LinearGauge.Border = CreateBorder(); m_LinearGauge.Padding = new NMargins(20); m_LinearGauge.BorderThickness = new NMargins(6); m_LinearGauge.BackgroundFill = new NStockGradientFill(NColor.DarkGray, NColor.Black); m_LinearGauge.Axes.Clear(); } private NGaugeAxis CreateGaugeAxis() { NGaugeAxis axis = new NGaugeAxis(); axis.Range = m_AxisRange; axis.Anchor = new NDockGaugeAxisAnchor(ENGaugeAxisDockZone.Top, true, ENScaleOrientation.Left, 0, 100); axis.Scale.SetColor(NColor.White); ((NLinearScale)axis.Scale).Labels.Style.TextStyle.Font.Style = ENFontStyle.Bold; return axis; } private NRangeIndicator CreateRangeIndicator(double offsetFromScale) { NRangeIndicator rangeIndicator = new NRangeIndicator(); rangeIndicator.Value = 0; rangeIndicator.Stroke = null; rangeIndicator.OffsetFromScale = offsetFromScale; rangeIndicator.BeginWidth = 10; rangeIndicator.EndWidth = 10; rangeIndicator.BeginWidth = 10; rangeIndicator.EndWidth = 10; // assign palette to the indicator NColorValuePalette palette = new NColorValuePalette(new NColorValuePair[] { new NColorValuePair(80, NColor.Green), new NColorValuePair(100, NColor.Yellow), new NColorValuePair(120, NColor.Red) }); rangeIndicator.Palette = palette; return rangeIndicator; } #endregion #region Event Handlers private void OnStackRegistered(NEventArgs arg) { m_Timer = new NTimer(); m_Timer.Tick += OnTimerTick; m_Timer.Start(); } private void OnStackUnregistered(NEventArgs arg) { m_Timer.Stop(); m_Timer.Tick -= OnTimerTick; m_Timer = null; } void OnSweepAngleUpDownValueChanged(NValueChangeEventArgs arg) { m_RadialGauge.SweepAngle = new NAngle(((NNumericUpDown)arg.TargetNode).Value); } void OnBeginAngleUpDownValueChanged(NValueChangeEventArgs arg) { m_RadialGauge.BeginAngle = new NAngle(((NNumericUpDown)arg.TargetNode).Value); } void OnInvertScaleCheckBoxCheckedChanged(NValueChangeEventArgs arg) { m_LinearGauge.Axes[0].Scale.Invert = ((NCheckBox)arg.TargetNode).Checked; m_RadialGauge.Axes[0].Scale.Invert = ((NCheckBox)arg.TargetNode).Checked; } void OnPaletteColorModeComboSelectedIndexChanged(NValueChangeEventArgs arg) { ENPaletteColorMode paletteColorMode = (ENPaletteColorMode)((NComboBox)arg.TargetNode).SelectedIndex; for (int i = 0; i < m_LinearGauge.Indicators.Count; i++) { ((NRangeIndicator)m_LinearGauge.Indicators[i]).PaletteColorMode = paletteColorMode; } ((NRangeIndicator)m_RadialGauge.Indicators[0]).PaletteColorMode = paletteColorMode; } void OnOrientationComboSelectedIndexChanged(NValueChangeEventArgs arg) { m_LinearGauge.Orientation = (ENLinearGaugeOrientation)((NComboBox)arg.TargetNode).SelectedIndex; switch (m_LinearGauge.Orientation) { case ENLinearGaugeOrientation.Horizontal: m_LinearGauge.PreferredWidth = 300; m_LinearGauge.PreferredHeight = 200; break; case ENLinearGaugeOrientation.Vertical: m_LinearGauge.PreferredWidth = 200; m_LinearGauge.PreferredHeight = 300; break; } } void OnRangeIndicatorShapeComboSelectedIndexChanged(NValueChangeEventArgs arg) { ENRangeIndicatorShape shape = (ENRangeIndicatorShape)((NComboBox)arg.TargetNode).SelectedIndex; for (int i = 0; i < m_LinearGauge.Indicators.Count; i++) { ((NRangeIndicator)m_LinearGauge.Indicators[i]).Shape = shape; } ((NRangeIndicator)m_RadialGauge.Indicators[0]).Shape = shape; } void OnToggleTimerButtonClick(NEventArgs arg) { NButton button = (NButton)arg.TargetNode; if ((int)button.Tag == 0) { m_Timer.Stop(); button.Content = new NLabel("Start Timer"); button.Tag = 1; } else { m_Timer.Start(); button.Content = new NLabel("Stop Timer"); button.Tag = 0; } } void OnTimerTick() { Random random = new Random(); for (int i = 0; i < m_LinearGauge.Indicators.Count; i++) { double value = (m_AxisRange.Begin + m_AxisRange.End) / 2.0 + Math.Sin(m_IndicatorPhase[i] * NAngle.Degree2Rad) * m_AxisRange.GetLength() / 2 + random.Next(20); value = m_AxisRange.GetValueInRange(value); ((NRangeIndicator)m_LinearGauge.Indicators[i]).Value = value; m_IndicatorPhase[i] += 10; } ((NRangeIndicator)m_RadialGauge.Indicators[0]).Value = ((NRangeIndicator)m_LinearGauge.Indicators[0]).Value; } void OnSmoothPaletteCheckBoxCheckedChanged(NValueChangeEventArgs arg) { bool smoothPalette = ((NCheckBox)arg.TargetNode).Checked; for (int i = 0; i < m_LinearGauge.Indicators.Count; i++) { m_LinearGauge.Indicators[i].Palette.InterpolateColors = smoothPalette; } m_RadialGauge.Indicators[0].Palette.InterpolateColors = smoothPalette; } #endregion #region Fields NLinearGauge m_LinearGauge; NRadialGauge m_RadialGauge; NTimer m_Timer; double[] m_IndicatorPhase; NRange m_AxisRange; #endregion #region Static Methods private static NBorder CreateBorder() { return NBorder.CreateThreeColorBorder(NColor.LightGray, NColor.White, NColor.DarkGray, 10, 10); } #endregion #region Constants private static readonly NSize defaultRadialGaugeSize = new NSize(300, 300); #endregion #region Nested Types #endregion } }

Download a fully functional C# (.cs) Palette Example for WPF Solution

VB.NET Palette Example Code for Nevron Gauge for WPF
Language: VB.NET

Imports Nevron.Nov
Imports Nevron.Nov.Chart
Imports Nevron.Nov.Dom
Imports Nevron.Nov.Graphics
Imports Nevron.Nov.Layout
Imports Nevron.Nov.UI
Imports Nevron.Nov.Windows.Wpf
Imports System

Class MainWindow

#Region "Constructors"

	Public Sub New()
		' This call is required by the designer.
		InitializeComponent()

		' Add any initialization after the InitializeComponent() call.

		' Set form title
		Title = "NOV WPF - NIndicatorPaletteExample"

		' Create the NOV example and its controls
		Dim exampleContent As NWidget = CreateExampleContent()
		Dim exampleControls As NWidget = CreateExampleControls()
		If Not exampleControls Is Nothing Then
			exampleControls.PreferredWidth = 300
		End If

		' Place the example and its controls in a pair box
		Dim pairBox As NPairBox = 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
		Dim host As NNovWidgetHost(Of NWidget) = New NNovWidgetHost(Of NWidget)(pairBox)
		Content = host
	End Sub


#End Region

#Region "Example"

        Public Function CreateExampleContent() As NWidget
            Dim stack As NStackPanel = New NStackPanel()
            stack.HorizontalPlacement = ENHorizontalPlacement.Left

            m_AxisRange = New NRange(80, 130)
            Dim indicatorCount = 4
            m_IndicatorPhase = New Double(indicatorCount - 1) {}

            ' create gauges
            CreateLinearGauge()
            CreateRadialGauge()

            ' add to stack
            stack.Add(m_LinearGauge)
            stack.Add(m_RadialGauge)

            ' add axes
            m_LinearGauge.Axes.Add(CreateGaugeAxis())
            m_RadialGauge.Axes.Add(CreateGaugeAxis())

            Dim offset As Double = 10

            ' now add two indicators
            For i = 0 To indicatorCount - 1
                m_IndicatorPhase(i) = i * 30

                m_LinearGauge.Indicators.Add(CreateRangeIndicator(offset))
                offset += 20
            Next

            m_RadialGauge.Indicators.Add(CreateRangeIndicator(0))

            stack.Registered += AddressOf OnStackRegistered
            stack.Unregistered += AddressOf OnStackUnregistered

            Return stack
        End Function
        Public Function CreateExampleControls() As NWidget
            Dim stack As NStackPanel = New NStackPanel()

            Dim propertyStack As NStackPanel = New NStackPanel()
            stack.Add(New NUniSizeBoxGroup(propertyStack))

            Dim toggleTimerButton As NButton = New NButton("Stop Timer")
            toggleTimerButton.Click += AddressOf OnToggleTimerButtonClick
            toggleTimerButton.Tag = 0
            stack.Add(toggleTimerButton)

            Dim rangeIndicatorShapeCombo As NComboBox = New NComboBox()
            rangeIndicatorShapeCombo.Items.FillFromEnum(Of ENRangeIndicatorShape)()
            rangeIndicatorShapeCombo.SelectedIndexChanged += AddressOf OnRangeIndicatorShapeComboSelectedIndexChanged
            rangeIndicatorShapeCombo.SelectedIndex = CInt(ENRangeIndicatorShape.Bar)
            stack.Add(NPairBox.Create("Shape:", rangeIndicatorShapeCombo))

            Dim paletteColorModeCombo As NComboBox = New NComboBox()
            paletteColorModeCombo.Items.FillFromEnum(Of ENPaletteColorMode)()
            paletteColorModeCombo.SelectedIndexChanged += AddressOf OnPaletteColorModeComboSelectedIndexChanged
            paletteColorModeCombo.SelectedIndex = CInt(ENPaletteColorMode.Spread)
            stack.Add(NPairBox.Create("Palette Color Mode:", paletteColorModeCombo))

            Dim orientationCombo As NComboBox = New NComboBox()
            orientationCombo.Items.FillFromEnum(Of ENLinearGaugeOrientation)()
            orientationCombo.SelectedIndexChanged += AddressOf OnOrientationComboSelectedIndexChanged
            orientationCombo.SelectedIndex = CInt(ENLinearGaugeOrientation.Vertical)
            stack.Add(NPairBox.Create("Orientation", orientationCombo))

            Dim beginAngleUpDown As NNumericUpDown = New NNumericUpDown()
            beginAngleUpDown.Value = m_RadialGauge.BeginAngle.Value
            beginAngleUpDown.ValueChanged += AddressOf OnBeginAngleUpDownValueChanged
            stack.Add(NPairBox.Create("Begin Angle:", beginAngleUpDown))

            Dim sweepAngleUpDown As NNumericUpDown = New NNumericUpDown()
            sweepAngleUpDown.Value = m_RadialGauge.BeginAngle.Value
            sweepAngleUpDown.ValueChanged += AddressOf OnSweepAngleUpDownValueChanged
            stack.Add(NPairBox.Create("Sweep Angle:", sweepAngleUpDown))

            Dim invertScaleCheckBox As NCheckBox = New NCheckBox("Invert Scale")
            invertScaleCheckBox.CheckedChanged += AddressOf OnInvertScaleCheckBoxCheckedChanged
            invertScaleCheckBox.Checked = False
            stack.Add(invertScaleCheckBox)

            Dim smoothPaletteCheckBox As NCheckBox = New NCheckBox("Smooth Palette")
            smoothPaletteCheckBox.CheckedChanged += AddressOf OnSmoothPaletteCheckBoxCheckedChanged
            smoothPaletteCheckBox.Checked = True
            stack.Add(smoothPaletteCheckBox)

            Return stack
        End Function
        Public Function GetExampleDescription() As String
            Return "

This example demonstrates how to associate a palette with an indicator.

" End Function ''' ''' Gets the relevant documentation links for the example ''' ''' Public Function GetDocumentationUrls() As (String, String)() Return {("Gauges Indicators Overview", "https://www.nevron.com/docs/openvision/gauges-indicators-overview.html"), ("Gauges Needle Indicator", "https://www.nevron.com/docs/openvision/gauges-needle-indicator.html"), ("Gauges Range Indicator", "https://www.nevron.com/docs/openvision/gauges-range-indicator.html")} End Function #End Region #Region "Implementation" Private Sub CreateRadialGauge() m_RadialGauge = New NRadialGauge() m_RadialGauge.PreferredSize = defaultRadialGaugeSize m_RadialGauge.CapEffect = New NGelCapEffect() m_RadialGauge.Border = CreateBorder() m_RadialGauge.BorderThickness = New NMargins(6) m_RadialGauge.BackgroundFill = New NStockGradientFill(NColor.DarkGray, NColor.Black) m_RadialGauge.NeedleCap.Visible = False m_RadialGauge.PreferredWidth = 200 m_RadialGauge.PreferredHeight = 200 m_RadialGauge.Padding = New NMargins(5) End Sub Private Sub CreateLinearGauge() m_LinearGauge = New NLinearGauge() m_LinearGauge.Orientation = ENLinearGaugeOrientation.Vertical m_LinearGauge.PreferredWidth = 200 m_LinearGauge.PreferredHeight = 300 m_LinearGauge.CapEffect = New NGlassCapEffect() m_LinearGauge.Border = CreateBorder() m_LinearGauge.Padding = New NMargins(20) m_LinearGauge.BorderThickness = New NMargins(6) m_LinearGauge.BackgroundFill = New NStockGradientFill(NColor.DarkGray, NColor.Black) m_LinearGauge.Axes.Clear() End Sub Private Function CreateGaugeAxis() As NGaugeAxis Dim axis As NGaugeAxis = New NGaugeAxis() axis.Range = m_AxisRange axis.Anchor = New NDockGaugeAxisAnchor(ENGaugeAxisDockZone.Top, True, ENScaleOrientation.Left, 0, 100) axis.Scale.SetColor(NColor.White) CType(axis.Scale, NLinearScale).Labels.Style.TextStyle.Font.Style = ENFontStyle.Bold Return axis End Function Private Function CreateRangeIndicator(offsetFromScale As Double) As NRangeIndicator Dim rangeIndicator As NRangeIndicator = New NRangeIndicator() rangeIndicator.Value = 0 rangeIndicator.Stroke = Nothing rangeIndicator.OffsetFromScale = offsetFromScale rangeIndicator.BeginWidth = 10 rangeIndicator.EndWidth = 10 rangeIndicator.BeginWidth = 10 rangeIndicator.EndWidth = 10 ' assign palette to the indicator Dim palette As NColorValuePalette = New NColorValuePalette(New NColorValuePair() {New NColorValuePair(80, NColor.Green), New NColorValuePair(100, NColor.Yellow), New NColorValuePair(120, NColor.Red)}) rangeIndicator.Palette = palette Return rangeIndicator End Function #End Region #Region "Event Handlers" Private Sub OnStackRegistered(arg As NEventArgs) m_Timer = New NTimer() Me.m_Timer.Tick += AddressOf OnTimerTick m_Timer.Start() End Sub Private Sub OnStackUnregistered(arg As NEventArgs) m_Timer.Stop() Me.m_Timer.Tick -= AddressOf OnTimerTick m_Timer = Nothing End Sub Private Sub OnSweepAngleUpDownValueChanged(arg As NValueChangeEventArgs) m_RadialGauge.SweepAngle = New NAngle(CType(arg.TargetNode, NNumericUpDown).Value) End Sub Private Sub OnBeginAngleUpDownValueChanged(arg As NValueChangeEventArgs) m_RadialGauge.BeginAngle = New NAngle(CType(arg.TargetNode, NNumericUpDown).Value) End Sub Private Sub OnInvertScaleCheckBoxCheckedChanged(arg As NValueChangeEventArgs) m_LinearGauge.Axes(0).Scale.Invert = CType(arg.TargetNode, NCheckBox).Checked m_RadialGauge.Axes(0).Scale.Invert = CType(arg.TargetNode, NCheckBox).Checked End Sub Private Sub OnPaletteColorModeComboSelectedIndexChanged(arg As NValueChangeEventArgs) Dim paletteColorMode As ENPaletteColorMode = CType(arg.TargetNode, NComboBox).SelectedIndex For i = 0 To m_LinearGauge.Indicators.Count - 1 CType(m_LinearGauge.Indicators(i), NRangeIndicator).PaletteColorMode = paletteColorMode Next CType(m_RadialGauge.Indicators(0), NRangeIndicator).PaletteColorMode = paletteColorMode End Sub Private Sub OnOrientationComboSelectedIndexChanged(arg As NValueChangeEventArgs) m_LinearGauge.Orientation = CType(CType(arg.TargetNode, NComboBox).SelectedIndex, ENLinearGaugeOrientation) Select Case m_LinearGauge.Orientation Case ENLinearGaugeOrientation.Horizontal m_LinearGauge.PreferredWidth = 300 m_LinearGauge.PreferredHeight = 200 Case ENLinearGaugeOrientation.Vertical m_LinearGauge.PreferredWidth = 200 m_LinearGauge.PreferredHeight = 300 End Select End Sub Private Sub OnRangeIndicatorShapeComboSelectedIndexChanged(arg As NValueChangeEventArgs) Dim shape As ENRangeIndicatorShape = CType(arg.TargetNode, NComboBox).SelectedIndex For i = 0 To m_LinearGauge.Indicators.Count - 1 CType(m_LinearGauge.Indicators(i), NRangeIndicator).Shape = shape Next CType(m_RadialGauge.Indicators(0), NRangeIndicator).Shape = shape End Sub Private Sub OnToggleTimerButtonClick(arg As NEventArgs) Dim button = CType(arg.TargetNode, NButton) If CInt(button.Tag) = 0 Then m_Timer.Stop() button.Content = New NLabel("Start Timer") button.Tag = 1 Else m_Timer.Start() button.Content = New NLabel("Stop Timer") button.Tag = 0 End If End Sub Private Sub OnTimerTick() Dim random As Random = New Random() For i = 0 To m_LinearGauge.Indicators.Count - 1 Dim value As Double = (m_AxisRange.Begin + m_AxisRange.End) / 2.0 + Math.Sin(m_IndicatorPhase(i) * NAngle.Degree2Rad) * m_AxisRange.GetLength() / 2 + random.Next(20) value = m_AxisRange.GetValueInRange(value) CType(m_LinearGauge.Indicators(i), NRangeIndicator).Value = value m_IndicatorPhase(i) += 10 Next CType(m_RadialGauge.Indicators(0), NRangeIndicator).Value = CType(m_LinearGauge.Indicators(0), NRangeIndicator).Value End Sub Private Sub OnSmoothPaletteCheckBoxCheckedChanged(arg As NValueChangeEventArgs) Dim smoothPalette = CType(arg.TargetNode, NCheckBox).Checked For i = 0 To m_LinearGauge.Indicators.Count - 1 m_LinearGauge.Indicators(i).Palette.InterpolateColors = smoothPalette Next m_RadialGauge.Indicators(0).Palette.InterpolateColors = smoothPalette End Sub #End Region #Region "Fields" Private m_LinearGauge As NLinearGauge Private m_RadialGauge As NRadialGauge Private m_Timer As NTimer Private m_IndicatorPhase As Double() Private m_AxisRange As NRange #End Region #Region "Static Methods" Private Shared Function CreateBorder() As NBorder Return NBorder.CreateThreeColorBorder(NColor.LightGray, NColor.White, NColor.DarkGray, 10, 10) End Function #End Region #Region "Constants" Private Shared ReadOnly defaultRadialGaugeSize As NSize = New NSize(300, 300) #End Region #Region "Nested Types" #End Region End Class

Download a fully functional VB.NET (.vb) Palette Example for WPF Solution