XamlStyleSerializer.cs source code in C# .NET

Source code for the .NET framework in C#

                        

Code:

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

                            //---------------------------------------------------------------------------- 
//
// File: XamlStyleSerializer.cs
//
// Description: 
//   Class that serializes and deserializes Styles.
// 
// Copyright (C) 2003 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;
#endif 

#if PBTCOMPILER
namespace MS.Internal.Markup
#else 
namespace System.Windows.Markup
#endif 
{ 
    /// 
    ///     Class that knows how to serialize and deserialize Style objects 
    /// 
    internal class XamlStyleSerializer : XamlSerializer
    {
 
#if PBTCOMPILER
 
        #region Construction 

        ///  
        ///     Constructor for XamlStyleSerializer
        /// 
        public XamlStyleSerializer() : base()
        { 
        }
 
        internal XamlStyleSerializer(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) 
        { 
            StyleXamlParser styleParser = new StyleXamlParser(tokenReader, context);
            styleParser.BamlRecordWriter = bamlWriter; 
            styleParser.ParserHooks = _parserHooks;


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