/// <summary>
        /// Used to create a command binding
        /// </summary>
        /// <param name="sourceExpression"></param>
        /// <param name="targetExpression"></param>
        /// <param name="containerID"></param>
        public BindingDef(IBindingTarget targetControl, string targetPropertyName, Options bindingOptions, IControlService controlService)
        {
            this.controlService   = controlService;
            this.sourceExpression = new BindingPath(bindingOptions.Path);

            string targetExpression = string.Format("{0}.{1}", targetControl.UniqueID, targetPropertyName);

            this.targetExpression = new BindingPath(targetExpression);
        }
Exemple #2
0
        public BindingPath(string raw, int indexer, BindingPath parent, PathMode mode)
            : this(raw, indexer)
        {
            this.parent = parent;

            if (mode == PathMode.Relative)
            {
                this.fullyQualified = GetFullExpression(parent);
            }
        }
        /// <summary>
        /// Used to create a data binding
        /// </summary>
        /// <param name="targetControl">The control to which to bind</param>
        /// <param name="targetPropertyName">The property of the control to which to bind</param>
        /// <param name="bindingOptions">Options to control the binding</param>
        /// <param name="isSourceEnumerable">Is the datasource to which you are binidng a collection</param>
        /// <param name="controlService">Service required for binding</param>
        public BindingDef(IBindingTarget targetControl, string targetPropertyName, Options bindingOptions, bool isSourceEnumerable, IControlService controlService)
        {
            this.controlService   = controlService;
            this.Container        = targetControl;
            this.sourceExpression = new BindingPath(bindingOptions.Path);

            string targetExpression = string.Format("{0}.{1}", targetControl.UniqueID, targetPropertyName);

            this.targetExpression = new BindingPath(targetExpression);

            this.bindingOptions     = bindingOptions;
            this.IsSourceEnumerable = isSourceEnumerable;
        }
        /// <summary>
        /// Used to create a nested data binding
        /// </summary>
        /// <param name="targetControl">The control to which to bind</param>
        /// <param name="targetPropertyName">The property of the control to which to bind</param>
        /// <param name="dataItemIndex">If the parent binding is a collection, the index is the data item for this binding. Else zerp</param>
        /// <param name="owningCollection">The collection of current bindings</param>
        /// <param name="bindingOptions">Options to control the binding</param>
        /// <param name="isSourceEnumerable">Is the datasource to which you are binidng a collection</param>
        /// <param name="controlService">Service required for binding</param>
        public BindingDef(IBindingTarget targetControl, string targetPropertyName, int dataItemIndex, BindingCollection owningCollection, Options bindingOptions, bool isSourceEnumerable, IControlService controlService)
        {
            this.controlService = controlService;
            this.Container      = targetControl;
            this.TrySetParent(owningCollection);
            this.sourceExpression = new BindingPath(bindingOptions.Path, dataItemIndex, GetParentExpression(), bindingOptions.PathMode);

            string targetExpression = string.Format("{0}.{1}", targetControl.UniqueID, targetPropertyName);

            this.targetExpression = new BindingPath(targetExpression);

            this.DataItemIndex      = dataItemIndex;
            this.bindingOptions     = bindingOptions;
            this.IsSourceEnumerable = isSourceEnumerable;
        }
Exemple #5
0
        public BindingPath(string raw, BindingPath parent)
        {
            this.parent = parent;

            this.raw     = raw;
            this.indexed = raw;
            if (mode == PathMode.Relative)
            {
                this.fullyQualified = GetFullExpression(parent);
            }
            else
            {
                this.fullyQualified = this.raw;
            }
        }
Exemple #6
0
        private string GetParentExpression(BindingPath parent)
        {
            string basic = string.Empty;

            if (parent != null)
            {
                basic = parent.Indexed;
                if (parent.Parent != null)
                {
                    basic = GetParentExpression(parent.Parent) + basic;
                }
            }

            if (basic.Length > 0 && !this.Indexed.StartsWith("["))
            {
                basic = basic + ".";
            }

            return(basic);
        }
Exemple #7
0
 private string GetFullExpression(BindingPath parent)
 {
     return(GetParentExpression(parent) + this.Indexed);
 }