2021-08-01 22:30:12 +08:00
|
|
|
|
using System;
|
2023-02-19 21:38:28 +08:00
|
|
|
|
using System.Windows;
|
2021-08-01 22:30:12 +08:00
|
|
|
|
using System.Windows.Data;
|
|
|
|
|
|
|
2022-12-12 22:33:17 +08:00
|
|
|
|
namespace AIStudio.Wpf.DiagramDesigner.Converters
|
2021-08-01 22:30:12 +08:00
|
|
|
|
{
|
2023-02-19 21:38:28 +08:00
|
|
|
|
public class IntToVisibilityConverter : IValueConverter
|
2021-08-01 22:30:12 +08:00
|
|
|
|
{
|
|
|
|
|
|
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
|
|
|
|
|
|
{
|
2023-02-19 21:38:28 +08:00
|
|
|
|
if (value == null || object.Equals(value, 0))
|
|
|
|
|
|
return Visibility.Collapsed;
|
2021-08-01 22:30:12 +08:00
|
|
|
|
else
|
2023-02-19 21:38:28 +08:00
|
|
|
|
return Visibility.Visible;
|
2021-08-01 22:30:12 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
|
|
|
|
|
|
{
|
2023-02-19 21:38:28 +08:00
|
|
|
|
if (object.Equals(value, Visibility.Collapsed))
|
|
|
|
|
|
return 0;
|
2021-08-01 22:30:12 +08:00
|
|
|
|
else
|
2023-02-19 21:38:28 +08:00
|
|
|
|
return 1;
|
2021-08-01 22:30:12 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|