-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix white on white text in DataGrid (#65)
- Loading branch information
Showing
4 changed files
with
72 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
src/MacOS.Avalonia.Theme/Converters/IsExplicitlyTrueConverter.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
using System.Globalization; | ||
using Avalonia.Data.Converters; | ||
|
||
namespace MacOS.Avalonia.Theme.Converters; | ||
|
||
/// <summary> | ||
/// Takes a _single_ input and returns a boolean based on whether the input is a boolean and true. | ||
/// </summary> | ||
/// <param name="value">Any property that may or may not exist</param> | ||
/// <returns>True if the input resolves to true, else False</returns> | ||
/// <remarks> | ||
/// This Converter can be used to check for a property when the source may not even exist. It needs to be a | ||
/// MultiValueConverter, | ||
/// because Avalonia will not call a normal converter if the input value is `unset`. | ||
/// Having this converter is useful, because Avalonia's AND and OR converters will return 'unset' if any of the inputs | ||
/// are unset, even when one of the inputs is a boolean and would be sufficient to verify the conjunction! | ||
/// </remarks> | ||
public class IsExplicitlyTrueConverter : IMultiValueConverter | ||
{ | ||
public object Convert(IList<object?> values, Type targetType, object? parameter, CultureInfo culture) | ||
{ | ||
return values[0] is true; | ||
} | ||
|
||
public object ConvertBack(IList<object?> values, Type targetType, object? parameter, CultureInfo culture) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
using System.Globalization; | ||
using Avalonia; | ||
using Avalonia.Data.Converters; | ||
|
||
namespace MacOS.Avalonia.Theme.Converters; | ||
|
||
/// <summary> | ||
/// Takes a _single_ input and returns a boolean if it is unset. | ||
/// </summary> | ||
/// <param name="value">Any property or property source that may or may not exist</param> | ||
/// <returns>True if the input resolves to AvaloniaProperty.UnsetValue, else False</returns> | ||
/// <remarks> | ||
/// This Converter can be used to check for the presence of a control or property. It needs to be a MultiValueConverter, | ||
/// because Avalonia will not call a normal converter if the input value is `unset`. | ||
/// Having this converter is useful, because Avalonia's AND and OR converters will return 'unset' if any of the inputs | ||
/// are unset, even when one of the inputs is a boolean and would be sufficient to verify the conjunction! | ||
/// </remarks> | ||
public class IsUnsetConverter : IMultiValueConverter | ||
{ | ||
public object Convert(IList<object?> values, Type targetType, object? parameter, CultureInfo culture) | ||
{ | ||
return values[0] == AvaloniaProperty.UnsetValue; | ||
} | ||
|
||
public object ConvertBack(IList<object?> values, Type targetType, object? parameter, CultureInfo culture) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters