/// <summary> /// Invoked when the current value is changed, and informs the viewmodel. /// </summary> /// <param name="sender">Sending object.</param> /// <param name="e">Event args.</param> private void DepthUpdated(Object sender, EventArgs e) { Object value = this.DepthHexDecBox.GetValue(); UInt32 realValue = value == null ? 0 : (UInt32)Conversions.ParsePrimitiveStringAsPrimitive(typeof(UInt32), value.ToString()); if (this.DepthHexDecBox.IsValid()) { this.DepthHexDecBox.SetValue(realValue.Clamp <UInt32>(0, PointerScannerViewModel.MaximumPointerScanDepth)); } this.PointerScannerViewModel.SetDepthCommand.Execute(realValue); }