123456789101112131415161718192021222324252627282930313233343536373839404142 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows;
- using System.Windows.Data;
- namespace CyberX8_Themes.Converters
- {
- public class StringToString : IValueConverter
- {
- public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
- {
- return value.ToString().Length > 6 ? value.ToString().Substring(5, 2): value.ToString().Substring(5, 1);
- }
- public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
- {
- if (!(value is bool))
- return false;
- return !(bool)value;
- }
- }
- public class StringToString2 : IValueConverter
- {
- public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
- {
- return value.ToString().Length >= 6 ? value.ToString().Substring(6, 1) : "0";
- }
- public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
- {
- if (!(value is bool))
- return false;
- return !(bool)value;
- }
- }
- }
|