40 lines
1.1 KiB
C#
40 lines
1.1 KiB
C#
using System;
|
|
using System.Windows;
|
|
using System.Windows.Data;
|
|
|
|
namespace WpfForWeb
|
|
{
|
|
[ValueConversion(typeof(Visibility), typeof(bool))]
|
|
class WaitValue : IValueConverter
|
|
{
|
|
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
|
|
{
|
|
Visibility vis = (Visibility)value;
|
|
switch (vis)
|
|
{
|
|
case Visibility.Collapsed:
|
|
return false;
|
|
case Visibility.Hidden:
|
|
return false;
|
|
case Visibility.Visible:
|
|
return true;
|
|
default:
|
|
return false;
|
|
}
|
|
}
|
|
|
|
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
|
|
{
|
|
bool b = (bool)value;
|
|
if (b == true)
|
|
{
|
|
return Visibility.Visible;
|
|
}
|
|
else
|
|
{
|
|
return Visibility.Collapsed;
|
|
}
|
|
}
|
|
}
|
|
}
|