private void FlagOption_FlagChanged(object sender, FlagChangedEventArgs e) { //Prepare Option option = null; //Check if (TagField != null && TagField is BaseFlagsField flagsField && sender is FlagOptionModel flagOptionModel && Flags.Contains(flagOptionModel)) { //Get index int flagIndex = Flags.IndexOf(flagOptionModel); option = flagsField.Options[flagIndex]; //Check if (e.Toggle != flagsField.HasFlag(option)) { //Set flagsField.SetFlag(option, e.Toggle); Owner.IsDirty = true; } } }
/// <summary> /// Occurs when the toggle state of the flag has been changed. /// </summary> /// <param name="e">The <see cref="FlagChangedEventArgs"/> that contains the event data.</param> protected virtual void OnFlagChanged(FlagChangedEventArgs e) { //Do nothing }