■ IValueConverter 인터페이스 : 타입→타입 명칭 값 변환자 만들기

----------------------------------------------------------------------------------------------------

 

using System;

using System.Globalization;

using System.Windows.Data;

 

/// <summary>

/// 타입→타입 명칭 값 변환자

/// </summary>

public class TypeToTypeNameValueConverter : IValueConverter

{

    //////////////////////////////////////////////////////////////////////////////////////////////////// Method

    ////////////////////////////////////////////////////////////////////////////////////////// Public

 

    #region 변환하기 - Convert(value, type, parameter, cultureInfo)

 

    /// <summary>

    /// 변환하기

    /// </summary>

    /// <param name="value"></param>

    /// <param name="type">타입</param>

    /// <param name="parameter">매개 변수</param>

    /// <param name="cultureInfo">CultureInfo 객체</param>

    /// <returns>변환 값</returns>

    public object Convert(object value, Type type, object parameter, CultureInfo cultureInfo)

    {

        return (value as Type).Name;

    }

 

    #endregion

 

    #region 역변환하기 - ConvertBack(value, type, parameter, cultureInfo)

 

    /// <summary>

    /// 역변환하기

    /// </summary>

    /// <param name="value"></param>

    /// <param name="type">타입</param>

    /// <param name="parameter">매개 변수</param>

    /// <param name="cultureInfo">CultureInfo 객체</param>

    /// <returns>역변환 값</returns>

    public object ConvertBack(object value, Type type, object parameter, CultureInfo cultureInfo)

    {

        return null;

    }

 

    #endregion

}

 

----------------------------------------------------------------------------------------------------

Posted by 사용자 icodebroker
TAG