BoolToVisibilityConverter.cpp 994 B

123456789101112131415161718192021222324252627282930
  1. #include "pch.h"
  2. #include "Converter/BoolToVisibilityConverter.h"
  3. #include "BoolToVisibilityConverter.g.cpp"
  4. namespace winrt::Maple_App::implementation
  5. {
  6. using namespace Windows::Foundation;
  7. using winrt::Windows::UI::Xaml::Interop::TypeName;
  8. IInspectable BoolToVisibilityConverter::Convert(
  9. IInspectable const& value,
  10. [[maybe_unused]] TypeName const& targetType,
  11. IInspectable const& parameter,
  12. [[maybe_unused]] hstring const& language
  13. )
  14. {
  15. bool const rev = parameter.try_as<bool>().value_or(false);
  16. bool const val = value.try_as<bool>().value_or(false);
  17. return box_value(val ^ rev);
  18. }
  19. IInspectable BoolToVisibilityConverter::ConvertBack(
  20. [[maybe_unused]] IInspectable const& value,
  21. [[maybe_unused]] TypeName const& targetType,
  22. [[maybe_unused]] IInspectable const& parameter,
  23. [[maybe_unused]] hstring const& language
  24. )
  25. {
  26. throw hresult_not_implemented();
  27. }
  28. }