public static IDataBinding ResolvePath(
            this IDataBinding dataContext,
            string pathString
            )
        {
            Path path = new Path(pathString);

            return(dataContext.ResolvePath(path));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Returns the databinding behind the given path. ArgumentException
        /// is thrown if the databinding could not be resolved.
        /// </summary>
        /// <param name="path">Path of requested databinding.</param>
        /// <returns>Databinding behind given path.</returns>
        public IDataBinding GetBinding(Path path)
        {
            Path workingCopy = new Path(path);

            try
            {
                PathElement firstPe = workingCopy.PathElements.ElementAt(0);
                workingCopy.PathElements.RemoveFirst();
                IDataBinding root = bindings[firstPe.FieldName];
                return(root.ResolvePath(workingCopy));
            }
            catch (Exception)
            {
                throw new ArgumentException("Could not resolve path: '" + path + "'");
            }
        }