1234567891011121314151617181920212223242526272829303132333435363738394041 |
- ///////////////////////////////////////////////////////////////////////////////
- //Copyright (c) 2015, 北京探索者软件公司
- //All rights reserved.
- //文件名称: IntToBooleanConvert.cs
- //文件描述: 根据数字转换布尔类型,前台绑定raido,附加参数使用
- //创 建 者: xls
- //创建日期: 2016-7-26
- //版 本 号:1.0.0.0
- ////////////////////////////////////////////////////////////////////////////////
- using System;
- using System.Globalization;
- using System.Windows.Data;
- namespace FWindSoft.Wpf
- {
- /// <summary>
- /// 当不想定义枚举是,使用整型值代替
- /// </summary>
- public class IntToBooleanConvert : IValueConverter
- {
- public static IntToBooleanConvert Instance = new IntToBooleanConvert();
- public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
- {
- object returnValue = false;
- if (parameter != null)
- {
- Object paramValue = parameter.ToString();
- returnValue = paramValue.Equals(value.ToString());
-
- }
- return returnValue;
- }
- public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
- {
- return System.Convert.ToInt32(parameter);
- }
- }
- }
|