/// <summary> /// 手工报价配置 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Button_Click(object sender, RoutedEventArgs e) { System.Windows.Data.BindingGroup bg = this.grid_set.BindingGroup; bool isValid = bg.ValidateWithoutUpdate(); if (!isValid) { MessageBox.Show("设置失败"); return; } XmlHelper.XmlSerializeToFile(manualPriceSet, file, Encoding.UTF8); MessageBox.Show("配置成功"); }
public override ValidationResult Validate(object value, System.Globalization.CultureInfo cultureInfo) { int newLevel = 1; Character item; try { System.Windows.Data.BindingGroup bindingGroup = (System.Windows.Data.BindingGroup)value; // Get the source object. item = bindingGroup.Items[0] as Character; object intValue; // If accessing the binding doesn't succeed, the property was not found if (!bindingGroup.TryGetValue(item, "Level", out intValue)) { return(new ValidationResult(false, "Level property was not found in editing object.")); } newLevel = int.Parse(intValue.ToString()); } catch (System.FormatException) { return(new ValidationResult(false, "Value is not a valid level.")); } if (item != null && item.CharClass == CharClass.DeathKnight && (newLevel < PlayerData.DEATHKNIGHT_LEVEL_REQUIREMENT || 85 < newLevel)) { return(new ValidationResult(false, "Death Knight Characters can only have a level range of 55-85.")); } else if (newLevel < 1 || 85 < newLevel) { return(new ValidationResult(false, "Characters can only have a level range of 1-85.")); } else { return(ValidationResult.ValidResult); } }
public PropertyGridTabItemContent() { Catalogs = new ObservableCollection <PropertyGridCatalogMetadata>(); DataContext = this; BindingGroup = new System.Windows.Data.BindingGroup(); }
protected virtual new void OnItemBindingGroupChanged(System.Windows.Data.BindingGroup oldItemBindingGroup, System.Windows.Data.BindingGroup newItemBindingGroup) { }