示例#1
0
        //private string GetXmlnsPrefix(IXamlSchemaContextProvider schemaProvider, Type type)
        //{
        //    string ourName = type.Name;
        //    XamlSchemaContext context = schemaProvider.SchemaContext;

        //    IEnumerable<string> namespaces = context.GetAllXamlNamespaces();

        //    foreach(string ns in namespaces)
        //    {
        //        ICollection<XamlType> xamlTypes = context.GetAllXamlTypes(ns);

        //        foreach(XamlType xt in xamlTypes)
        //        {
        //            if(xt.IsMarkupExtension)
        //            {
        //                if(xt.Name == ourName)
        //                {
        //                    return ns;
        //                }
        //            }
        //        }
        //    }

        //    return null;
        //}

        #endregion

        public Binding GetBinding(BindingTarget bindingTarget)
        {
            MyBindingInfo bindingInfo = GatherBindingInfo(Path, Mode);

            MyBindingEngine mb = new MyBindingEngine(bindingInfo, SourceType, _bindingTarget, UseMultiBinding);

            return(mb.ProvideTheBindingDirectly());
        }
示例#2
0
        public override object ProvideValue(IServiceProvider serviceProvider)
        {
            if (SourceType == null)
            {
                throw new InvalidOperationException("The SourceType must be specified.");
            }

            // Get the Target Object and Target Property
            if (!SetOurEnv(serviceProvider, out _bindingTarget))
            {
                return(this);
            }

            MyBindingInfo bindingInfo = GatherBindingInfo(Path, Mode);

            MyBindingEngine mb = new MyBindingEngine(bindingInfo, SourceType, _bindingTarget, UseMultiBinding);

            return(mb.ProvideValue(serviceProvider));
        }