TemplateBindingExpressionConverter.cs source code in C# .NET

Source code for the .NET framework in C#

                        

Code:

/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / Orcas / QFE / wpf / src / Framework / System / Windows / TemplateBindingExpressionConverter.cs / 1 / TemplateBindingExpressionConverter.cs

                            /****************************************************************************\ 
*
* File: TemplateBindingExpressionConverter.cs
*
*  Class for serializing a TemplateBindingExpression. 
*
* Copyright (C) 2005 by Microsoft Corporation.  All rights reserved. 
* 
\***************************************************************************/
 
using System;
using System.ComponentModel;
using System.Windows;
using System.Windows.Data; 
using System.Windows.Markup;
 
namespace System.Windows 
{
 

    /// 
    /// Converts a template binding expression into a MarkupExtension.  This is used
    /// during serialization (the serializer native knows how to serialize an ME). 
    /// 
    public class TemplateBindingExpressionConverter: TypeConverter 
    { 
        /// 
        /// Returns true for MarkupExtension 
        /// 
        public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType)
        {
            if (destinationType == typeof(MarkupExtension)) 
            {
                return true; 
            } 
            return base.CanConvertTo(context, destinationType);
        } 

        /// 
        /// Converts to a MarkupExtension
        ///  
        public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType)
        { 
            if (destinationType == typeof(MarkupExtension)) 
            {
                TemplateBindingExpression templateBindingExpression = value as TemplateBindingExpression; 
                if (templateBindingExpression == null)
                    throw new ArgumentException(SR.Get(SRID.MustBeOfType, "value", "TemplateBindingExpression"));
                return templateBindingExpression.TemplateBindingExtension;
            } 
            return base.ConvertTo(context, culture, value, destinationType);
        } 
    } 

 
}



// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
/****************************************************************************\ 
*
* File: TemplateBindingExpressionConverter.cs
*
*  Class for serializing a TemplateBindingExpression. 
*
* Copyright (C) 2005 by Microsoft Corporation.  All rights reserved. 
* 
\***************************************************************************/
 
using System;
using System.ComponentModel;
using System.Windows;
using System.Windows.Data; 
using System.Windows.Markup;
 
namespace System.Windows 
{
 

    /// 
    /// Converts a template binding expression into a MarkupExtension.  This is used
    /// during serialization (the serializer native knows how to serialize an ME). 
    /// 
    public class TemplateBindingExpressionConverter: TypeConverter 
    { 
        /// 
        /// Returns true for MarkupExtension 
        /// 
        public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType)
        {
            if (destinationType == typeof(MarkupExtension)) 
            {
                return true; 
            } 
            return base.CanConvertTo(context, destinationType);
        } 

        /// 
        /// Converts to a MarkupExtension
        ///  
        public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType)
        { 
            if (destinationType == typeof(MarkupExtension)) 
            {
                TemplateBindingExpression templateBindingExpression = value as TemplateBindingExpression; 
                if (templateBindingExpression == null)
                    throw new ArgumentException(SR.Get(SRID.MustBeOfType, "value", "TemplateBindingExpression"));
                return templateBindingExpression.TemplateBindingExtension;
            } 
            return base.ConvertTo(context, culture, value, destinationType);
        } 
    } 

 
}



// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
                        

Link Menu

Network programming in C#, Network Programming in VB.NET, Network Programming in .NET
This book is available now!
Buy at Amazon US or
Buy at Amazon UK