Exemple #1
0
        /// <summary>
        /// Loads XAML from the specified XamlXmlReader and returns the deserialized object.  Any event handlers
        /// are bound to methods defined in the provided Scope and converted using the provided DynamicOperations
        /// object.
        /// </summary>
        public static object LoadComponent(dynamic scope, DynamicOperations operations, XamlXmlReader reader)
        {
            var settings = new XamlObjectWriterSettings();

            settings.RootObjectInstance = scope;

            var myWriter = new DynamicWriter((object)scope, operations, reader.SchemaContext, settings);

            while (reader.Read())
            {
                myWriter.WriteNode(reader);
            }

            foreach (string name in myWriter.Names)
            {
                object value = myWriter.RootNameScope.FindName(name);
                if (value != null)
                {
                    operations.SetMember((object)scope, name, value);
                }
            }

            return(myWriter.Result);
        }
Exemple #2
0
 /// <summary>
 /// Sets the member name on object obj to value.
 /// </summary>
 public void SetMember(object obj, string name, object value)
 {
     _ops.SetMember(obj, name, value);
 }