XamlTemplateSerializer.cs source code in C# .NET

Source code for the .NET framework in C#

                        

Code:

/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / wpf / src / Framework / System / Windows / Markup / XamlTemplateSerializer.cs / 1305600 / XamlTemplateSerializer.cs

                            //---------------------------------------------------------------------------- 
//
// File: XamlTemplateSerializer.cs
//
// Description: 
//   Class that serializes and deserializes Templates.
// 
// Copyright (C) 2004 by Microsoft Corporation.  All rights reserved. 
//
//--------------------------------------------------------------------------- 

using System;
using System.ComponentModel;
 
using System.ComponentModel.Design.Serialization;
using System.Diagnostics; 
using System.Collections; 
using System.Globalization;
using System.IO; 
using System.Reflection;
using System.Text;
using System.Xml;
using System.Security.Permissions; 
using MS.Utility;
 
#if !PBTCOMPILER 
using System.Windows.Data;
using System.Windows.Controls; 
using System.Windows.Documents;
#endif

#if PBTCOMPILER 
namespace MS.Internal.Markup
#else 
namespace System.Windows.Markup 
#endif
{ 
    /// 
    ///     Class that knows how to serialize and deserialize Template objects
    /// 
    internal class XamlTemplateSerializer : XamlSerializer 
    {
 
#if PBTCOMPILER 
        #region Construction
 
        /// 
        ///     Constructor for XamlTemplateSerializer
        /// 
        public XamlTemplateSerializer() : base() 
        {
        } 
 

        internal XamlTemplateSerializer(ParserHooks parserHooks) : base() 
        {
            _parserHooks = parserHooks;
        }
 
        private ParserHooks _parserHooks = null;
 
        #endregion Construction 

        ///  
        ///   Convert from Xaml read by a token reader into baml being written
        ///   out by a record writer.  The context gives mapping information.
        /// 
        internal override void ConvertXamlToBaml ( 
            XamlReaderHelper             tokenReader,
            ParserContext          context, 
            XamlNode               xamlNode, 
            BamlRecordWriter       bamlWriter)
        { 

            TemplateXamlParser templateParser = new TemplateXamlParser(tokenReader, context);
            templateParser.ParserHooks = _parserHooks;
            templateParser.BamlRecordWriter = bamlWriter; 

            // Process the xamlNode that is passed in so that the