| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- using System;
- using System.Collections.Generic;
- using System.Globalization;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows;
- using System.Windows.Data;
- namespace ivf_tl_Operate.Converts
- {
- public class IntToBoolConverter : IValueConverter
- {
- public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
- {
- if (value == null)
- {
- return false;
- }
- else
- {
- if (value.ToString() == "0")
- return false;
- else
- return true;
- }
- }
- public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
- {
- if (value == null)
- {
- return 0;
- }
- else
- {
- if (bool.TryParse(value.ToString(), out bool result))
- {
- return result ? 1 : 0;
- }
- else
- {
- return 0;
- }
- }
- }
- }
- }
|