calculator/src/Calculator/Converters/VisibilityNegationConverter.cs
Rose 91adfd8e9e
Run C# import cleanup based on the Solution files (#1838)
This is to make the style consistent with the rest of the project as well as removing unused imports.
2022-06-14 15:56:37 +08:00

34 lines
1.0 KiB
C#

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
using System;
using Windows.UI.Xaml;
namespace CalculatorApp
{
namespace Common
{
/// <summary>
/// Value converter that translates Visible to Collapsed and vice versa
/// </summary>
[Windows.Foundation.Metadata.WebHostHidden]
public sealed class VisibilityNegationConverter : Windows.UI.Xaml.Data.IValueConverter
{
public object Convert(object value, Type targetType, object parameter, string language)
{
if (value is Visibility boxedVisibility && boxedVisibility == Visibility.Collapsed)
{
return Visibility.Visible;
}
return Visibility.Collapsed;
}
public object ConvertBack(object value, Type targetType, object parameter, string language)
{
return Convert(value, targetType, parameter, language);
}
}
}
}