Browse Source

Merge pull request #6430 from wieslawsoltes/BoolConvertersNot

Add Not value converter to BoolConverters
Max Katz 4 years ago
parent
commit
1ab3c2abcb
1 changed files with 6 additions and 0 deletions
  1. 6 0
      src/Avalonia.Base/Data/Converters/BoolConverters.cs

+ 6 - 0
src/Avalonia.Base/Data/Converters/BoolConverters.cs

@@ -18,5 +18,11 @@ namespace Avalonia.Data.Converters
         /// </summary>
         public static readonly IMultiValueConverter Or =
             new FuncMultiValueConverter<bool, bool>(x => x.Any(y => y));
+
+        /// <summary>
+        /// A value converter that returns true when input is false and false when input is true.
+        /// </summary>
+        public static readonly IValueConverter Not =
+            new FuncValueConverter<bool, bool>(x => !x);
     }
 }