This commit is contained in:
Dan Clark
2024-11-24 16:35:00 +00:00
parent 911ed375b4
commit d893335195
18 changed files with 282 additions and 200 deletions
@@ -0,0 +1,27 @@
using System;
using Toolkit.Foundation;
namespace Toolkit.UI.WinUI;
public class ValidationBooleanConverter :
ValueConverter<IReadOnlyIndexDictionary<string, string>, bool>
{
public string? Property { get; set; }
public bool TrueValue { get; set; } = true;
public bool FalseValue { get; set; } = false;
protected override bool ConvertTo(IReadOnlyIndexDictionary<string, string> value,
Type? targetType,
object? parameter,
string? language)
{
if (Property is { Length: > 0 } && value.ContainsKey(Property))
{
return TrueValue;
}
return FalseValue;
}
}