1234567891011121314151617181920212223242526272829303132333435363738394041 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Data;
- namespace FurnaceUI.Converter
- {
- public class BoolToStringConvert : IValueConverter
- {
- public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
- {
- if (value == null || !(value is bool)) return parameter;
- string[] par = ((string)parameter).Split(',');
- if (par.Length < 2) return par[0];
- if (value is bool)
- {
- if ((bool)value)
- {
- return par[0];
- }
- else
- {
- return par[1];
- }
- }
- else
- {
- return parameter;
- }
- }
- public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
- {
- throw new NotImplementedException();
- }
- }
- }
|