/// <summary> /// Provides derived classes an opportunity to handle changes /// to the Model property. /// </summary> /// <param name="oldModel">The old Model value</param> /// <param name="newModel">The new Model value</param> private void OnModelChanged( BasePropertyViewModel oldModel, BasePropertyViewModel newModel) { if (newModel == null) { return; } var scb = newModel.Value as SolidColorBrush; if (scb != null) { _ignoreTextChange = true; this.ValueTextBox.Text = scb.Color.ToString(); return; } var ib = newModel.Value as ImageBrush; if (ib != null) { var bi = ib.ImageSource as BitmapImage; if (bi != null && bi.UriSource != null && !string.IsNullOrEmpty(bi.UriSource.ToString())) { _ignoreTextChange = true; this.ValueTextBox.Text = bi.UriSource.ToString(); } } }
/// <summary> /// Provides derived classes an opportunity to handle changes /// to the Model property. /// </summary> /// <param name="oldModel">The old Model value</param> /// <param name="newModel">The new Model value</param> private void OnModelChanged( BasePropertyViewModel oldModel, BasePropertyViewModel newModel) { if (newModel == null) { return; } var bi = newModel.Value as BitmapImage; if (bi != null && bi.UriSource != null && !string.IsNullOrEmpty(bi.UriSource.ToString())) { this.ValueTextBox.Text = bi.UriSource.ToString(); } }
/// <summary> /// Provides derived classes an opportunity to handle changes /// to the Model property. /// </summary> /// <param name="oldModel">The old Model value</param> /// <param name="newModel">The new Model value</param> private void OnModelChanged( BasePropertyViewModel oldModel, BasePropertyViewModel newModel) { if (this.EnumType != null) { UpdateSelection(); } }
private void UpdateModelNumericValue(BasePropertyViewModel model) { if (this.NumericType == typeof (byte)) { model.Value = (byte)this.NumericUpDown.Value; } else if (this.NumericType == typeof (Int16)) { model.Value = (Int16)this.NumericUpDown.Value; } else if (this.NumericType == typeof (UInt16)) { model.Value = (UInt16)this.NumericUpDown.Value; } else if (this.NumericType == typeof (int)) { model.Value = (int)this.NumericUpDown.Value; } else if (this.NumericType == typeof (uint)) { model.Value = (uint)this.NumericUpDown.Value; } else if (this.NumericType == typeof (Int64)) { model.Value = (Int64)this.NumericUpDown.Value; } else if (this.NumericType == typeof (UInt64)) { model.Value = (UInt64)this.NumericUpDown.Value; } else if (this.NumericType == typeof (float)) { model.Value = (float)this.NumericUpDown.Value; } else if (this.NumericType == typeof (double)) { model.Value = this.NumericUpDown.Value; } }
/// <summary> /// Provides derived classes an opportunity to handle changes /// to the Model property. /// </summary> /// <param name="oldModel">The old Model value</param> /// <param name="newModel">The new Model value</param> private void OnModelChanged( BasePropertyViewModel oldModel, BasePropertyViewModel newModel) { if (oldModel != null) { oldModel.PropertyChanged -= OnModelPropertyChanged; } if (this.NumericType != null) { ReadModelValue(); } if (newModel != null) { newModel.PropertyChanged += OnModelPropertyChanged; } }
/// <summary> /// Provides derived classes an opportunity to handle changes /// to the Model property. /// </summary> /// <param name="oldModel">The old Model value</param> /// <param name="newModel">The new Model value</param> private void OnModelChanged( BasePropertyViewModel oldModel, BasePropertyViewModel newModel) { ReadModelValue(); }