27 lines
614 B
C#
27 lines
614 B
C#
using Microsoft.UI.Xaml;
|
|
using Microsoft.UI.Xaml.Data;
|
|
|
|
|
|
namespace RustTools.Services;
|
|
|
|
public class BooleanToVisibilityConverter : IValueConverter
|
|
{
|
|
public object Convert(object value, Type targetType, object parameter, string language)
|
|
{
|
|
|
|
return string.IsNullOrEmpty(value.ToString()) ? Visibility.Collapsed: Visibility.Visible;
|
|
|
|
|
|
}
|
|
|
|
public object ConvertBack(object value, Type targetType, object parameter, string language)
|
|
{
|
|
if (value is Visibility visibility)
|
|
{
|
|
return visibility == Visibility.Visible;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
}
|