| 1 | // Copyright (C) Microsoft Corporation. All rights reserved. |
| 2 | |
| 3 | using Microsoft.UI.Xaml.Data; |
| 4 | using Microsoft.UI.Xaml; |
| 5 | |
| 6 | namespace WslSettings.Converters |
| 7 | { |
| 8 | public sealed class BooleanToVisibilityConverter : IValueConverter |
| 9 | { |
| 10 | public object Convert(object value, Type targetType, object parameter, string language) |
| 11 | { |
| 12 | return (value is bool && (bool)value) ? Visibility.Visible : Visibility.Collapsed; |
| 13 | } |
| 14 | |
| 15 | public object ConvertBack(object value, Type targetType, object parameter, string language) |
| 16 | { |
| 17 | return value is Visibility && (Visibility)value == Visibility.Visible; |
| 18 | } |
| 19 | } |
| 20 | } |