Exemple #1
0
        /// <summary>
        /// Loads XAML from the specified XmlReader and returns the deserialized object.  Any event handlers
        /// are bound to methods defined in the provided module.  Any named objects are assigned to the object.
        ///
        /// The provided object is expected to be the same type as the root of the XAML element.
        /// </summary>
        public static object LoadComponent(CodeContext context, object self, [NotNull] XmlReader xmlReader)
        {
            if (self == null)
            {
                throw PythonOps.TypeError("expected module, got None");
            }

            return(DynamicXamlReader.LoadComponent(self, context.LanguageContext.Operations, xmlReader, XamlReader.GetWpfSchemaContext()));
        }
Exemple #2
0
        /// <summary>
        /// Loads XAML from the specified XmlReader and returns the deserialized object.  Any event handlers
        /// are bound to methods defined in the provided module.  Any named objects are assigned to the object.
        ///
        /// The provided object is expected to be the same type as the root of the XAML element.
        /// </summary>
        public static object LoadComponent(CodeContext context, object self, string filename)
        {
            if (filename == null)
            {
                throw PythonOps.TypeError("expected str, got None");
            }
            else if (self == null)
            {
                throw PythonOps.TypeError("expected module, got None");
            }

            return(DynamicXamlReader.LoadComponent(self, context.LanguageContext.Operations, filename, XamlReader.GetWpfSchemaContext()));
        }