diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 9a0da4aa9b..78b9cff039 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,16 +1,31 @@ -This template is not intended to be prescriptive, but to help us review pull requests it would be useful if you included as much of the following information as possible: +## What does the pull request do? -- What does the pull request do? -- What is the current behavior? -- What is the updated/expected behavior with this PR? -- How was the solution implemented (if it's not obvious)? +Give a bit of background on the PR here, together with links to with related issues etc. -Checklist: +## What is the current behavior? + +If the PR is a fix, describe the current incorrect behavior, otherwise delete this section. + +## What is the updated/expected behavior with this PR? + +Describe how to test the PR. + +## How was the solution implemented (if it's not obvious)? + +Include any information that might be of use to a reviewer here. + +## Checklist - [ ] Added unit tests (if possible)? - [ ] Added XML documentation to any related classes? - [ ] Consider submitting a PR to https://github.com/AvaloniaUI/Avaloniaui.net with user documentation +## Breaking changes + +List any breaking changes here. When the PR is merged please add an entry to https://github.com/AvaloniaUI/Avalonia/wiki/Breaking-Changes + +## Fixed issues + If the pull request fixes issue(s) list them like this: Fixes #123 diff --git a/src/Avalonia.Base/Data/Converters/ObjectConverters.cs b/src/Avalonia.Base/Data/Converters/ObjectConverters.cs new file mode 100644 index 0000000000..3cadfd5b47 --- /dev/null +++ b/src/Avalonia.Base/Data/Converters/ObjectConverters.cs @@ -0,0 +1,24 @@ +// Copyright (c) The Avalonia Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. + + +namespace Avalonia.Data.Converters +{ + /// + /// Provides a set of useful s for working with objects. + /// + public static class ObjectConverters + { + /// + /// A value converter that returns true if the input object is a null reference. + /// + public static readonly IValueConverter IsNull = + new FuncValueConverter(x => x is null); + + /// + /// A value converter that returns true if the input object is not null. + /// + public static readonly IValueConverter IsNotNull = + new FuncValueConverter(x => !(x is null)); + } +} diff --git a/src/Avalonia.Base/Data/Converters/StringConverters.cs b/src/Avalonia.Base/Data/Converters/StringConverters.cs index 0101cf5d29..42eb8e1d81 100644 --- a/src/Avalonia.Base/Data/Converters/StringConverters.cs +++ b/src/Avalonia.Base/Data/Converters/StringConverters.cs @@ -12,13 +12,13 @@ namespace Avalonia.Data.Converters /// /// A value converter that returns true if the input string is null or an empty string. /// - public static readonly IValueConverter NullOrEmpty = + public static readonly IValueConverter IsNullOrEmpty = new FuncValueConverter(string.IsNullOrEmpty); /// /// A value converter that returns true if the input string is not null or empty. /// - public static readonly IValueConverter NotNullOrEmpty = + public static readonly IValueConverter IsNotNullOrEmpty = new FuncValueConverter(x => !string.IsNullOrEmpty(x)); } } diff --git a/src/Avalonia.Controls/ContentControl.cs b/src/Avalonia.Controls/ContentControl.cs index 20ec581108..6da6da54a5 100644 --- a/src/Avalonia.Controls/ContentControl.cs +++ b/src/Avalonia.Controls/ContentControl.cs @@ -45,8 +45,6 @@ namespace Avalonia.Controls static ContentControl() { ContentControlMixin.Attach(ContentProperty, x => x.LogicalChildren); - PseudoClass(ContentProperty, x => x != null, ":valid"); - PseudoClass(ContentProperty, x => x == null, ":invalid"); } /// diff --git a/src/Avalonia.Themes.Default/CheckBox.xaml b/src/Avalonia.Themes.Default/CheckBox.xaml index e2301b9b09..f87ae2674f 100644 --- a/src/Avalonia.Themes.Default/CheckBox.xaml +++ b/src/Avalonia.Themes.Default/CheckBox.xaml @@ -1,9 +1,10 @@ - + - diff --git a/src/Avalonia.Themes.Default/TextBox.xaml b/src/Avalonia.Themes.Default/TextBox.xaml index 90100c2f2b..6741bdc7d9 100644 --- a/src/Avalonia.Themes.Default/TextBox.xaml +++ b/src/Avalonia.Themes.Default/TextBox.xaml @@ -23,7 +23,7 @@ Path="UseFloatingWatermark"/> + Converter="{x:Static StringConverters.IsNotNullOrEmpty}"/> @@ -36,7 +36,7 @@ + IsVisible="{TemplateBinding Text, Converter={x:Static StringConverters.IsNullOrEmpty}}"/>