Beispiel #1
0
        public object ConvertFrom(XamlNamespaces namespaces, Uri sourceUri, object value)
        {
            string text = value.ToString().Trim();

            int typeSeparatorIndex = text.IndexOf(".");

            if (typeSeparatorIndex == -1)
            {
                throw new Granular.Exception("Dependency property \"{0}\" does not contain owner type name", text);
            }

            Type ownerType = TypeParser.ParseType(text.Substring(0, typeSeparatorIndex), namespaces);
            DependencyProperty dependencyProperty = DependencyProperty.GetOwnedProperty(ownerType, text.Substring(typeSeparatorIndex + 1));

            if (dependencyProperty == null)
            {
                throw new Granular.Exception("Can't find dependency property named \"{0}\"", text);
            }

            return(dependencyProperty);
        }