/// <summary>
        /// Binds <see cref="IColumns"/> to <see cref="ValidationPlaceholder"/>.
        /// </summary>
        /// <param name="source">The source <see cref="IColumns"/>.</param>
        /// <param name="bindings">The bindings to determine whether the <see cref="ValidationPlaceholder"/> is active.</param>
        /// <returns>The row binding object.</returns>
        public static RowBinding <ValidationPlaceholder> BindToValidationPlaceholder(this IColumns source, params RowBinding[] bindings)
        {
            source.VerifyNotNull(nameof(source));

            source = source.Seal();

            var result = new RowBinding <ValidationPlaceholder>(onSetup: (v, p) =>
            {
                if (bindings != null && bindings.Length > 0)
                {
                    var containingElements = new UIElement[bindings.Length];
                    for (int i = 0; i < containingElements.Length; i++)
                    {
                        containingElements[i] = bindings[i].GetSettingUpElement();
                    }
                    v.Setup(containingElements);
                }
            }, onRefresh: null, onCleanup: (v, p) =>
            {
                v.Cleanup();
            });
            var input = result.BeginInput(new ValueChangedTrigger <ValidationPlaceholder>(source, result));

            foreach (var column in source)
            {
                input.WithFlush(column, (r, v) => true);
            }
            return(input.EndInput());
        }
Exemplo n.º 2
0
 /// <summary>
 /// Ends the input implementation.
 /// </summary>
 /// <returns>The row binding for fluent coding.</returns>
 public RowBinding <T> EndInput()
 {
     _target = _target.Seal();
     return(RowBinding);
 }
Exemplo n.º 3
0
 private RowAsyncValidator(string displayName, IColumns sourceColumns)
     : base(displayName)
 {
     Debug.Assert(sourceColumns != null && sourceColumns.Count > 0);
     _sourceColumns = sourceColumns.Seal();
 }