Visibility variable holding collapsed but then turning into visible is unnecessary when one can return Visibility::Collapsed or Visibility::Visible.
32 lines
1.0 KiB
C++
32 lines
1.0 KiB
C++
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
// Licensed under the MIT License.
|
|
|
|
#include "pch.h"
|
|
#include "VisibilityNegationConverter.h"
|
|
|
|
using namespace Platform;
|
|
using namespace Windows::Foundation;
|
|
using namespace Windows::UI::Xaml;
|
|
using namespace Windows::UI::Xaml::Interop;
|
|
|
|
namespace CalculatorApp
|
|
{
|
|
namespace Common
|
|
{
|
|
Object ^ VisibilityNegationConverter::Convert(Object ^ value, TypeName /*targetType*/, Object ^ /*parameter*/, String ^ /*language*/)
|
|
{
|
|
auto boxedVisibility = dynamic_cast<Box<Visibility> ^>(value);
|
|
if (boxedVisibility != nullptr && boxedVisibility->Value == Visibility::Collapsed)
|
|
{
|
|
return Visibility::Visible;
|
|
}
|
|
return Visibility::Collapsed;
|
|
}
|
|
|
|
Object ^ VisibilityNegationConverter::ConvertBack(Object ^ value, TypeName targetType, Object ^ parameter, String ^ language)
|
|
{
|
|
return Convert(value, targetType, parameter, language);
|
|
}
|
|
}
|
|
}
|