/// <summary> /// Applies the current order of conditions to the <see cref="Modifiers" /> collection /// </summary> public void ApplyOrder() { _modifiers.Sort((a, b) => a.Order.CompareTo(b.Order)); for (int index = 0; index < _modifiers.Count; index++) { DataBindingModifier <TLayerProperty, TProperty> modifier = _modifiers[index]; modifier.Order = index + 1; } }
/// <summary> /// Adds a modifier to the direct data binding's <see cref="Modifiers" /> collection /// </summary> /// <param name="type">The type of the parameter, can either be dynamic (based on a data model value) or static</param> public DataBindingModifier <TLayerProperty, TProperty> AddModifier(ProfileRightSideType type) { if (_disposed) { throw new ObjectDisposedException("DirectDataBinding"); } DataBindingModifier <TLayerProperty, TProperty> modifier = new DataBindingModifier <TLayerProperty, TProperty>(this, type); _modifiers.Add(modifier); ApplyOrder(); OnModifiersUpdated(); return(modifier); }
/// <summary> /// Removes a modifier from the direct data binding's <see cref="Modifiers" /> collection and disposes it /// </summary> public void RemoveModifier(DataBindingModifier <TLayerProperty, TProperty> modifier) { if (_disposed) { throw new ObjectDisposedException("DirectDataBinding"); } if (!_modifiers.Contains(modifier)) { return; } _modifiers.Remove(modifier); modifier.Dispose(); ApplyOrder(); OnModifiersUpdated(); }