Browse Source
`:valid` and `:invalid` pseudoclasses are being added to all `ContentControls` simply in order to show/hide the `ContentPresenter` in `CheckBox`. Instead of this, add some `ObjectConverters` and use them to set the visibility of the `ContentPresenter.` Also renamed the converters in `StringConverters` to add an `Is` prefix as the `ObjectConverters` didn't look right as just `Null` and `NotNull`.pull/2253/head
5 changed files with 32 additions and 11 deletions
@ -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 |
|||
{ |
|||
/// <summary>
|
|||
/// Provides a set of useful <see cref="IValueConverter"/>s for working with objects.
|
|||
/// </summary>
|
|||
public static class ObjectConverters |
|||
{ |
|||
/// <summary>
|
|||
/// A value converter that returns true if the input object is a null reference.
|
|||
/// </summary>
|
|||
public static readonly IValueConverter IsNull = |
|||
new FuncValueConverter<object, bool>(x => x is null); |
|||
|
|||
/// <summary>
|
|||
/// A value converter that returns true if the input object is not null.
|
|||
/// </summary>
|
|||
public static readonly IValueConverter IsNotNull = |
|||
new FuncValueConverter<object, bool>(x => !(x is null)); |
|||
} |
|||
} |
|||
Loading…
Reference in new issue