add readonly password reveal

This commit is contained in:
TheXamlGuy
2024-07-06 17:01:50 +01:00
parent 543ea01e62
commit 02c7c03251
2 changed files with 22 additions and 1 deletions
@@ -0,0 +1,21 @@
using Avalonia.Data.Converters;
using Avalonia.Markup.Xaml;
using System.Globalization;
namespace Toolkit.UI.Avalonia;
public class BooleanToPasswordCharConverter :
MarkupExtension,
IValueConverter
{
public override object ProvideValue(IServiceProvider serviceProvider) =>
this;
public char PasswordChar { get; set; }
public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture) =>
value is bool boolValue ? boolValue ? '\0' : PasswordChar : (object)PasswordChar;
public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture) =>
throw new NotImplementedException();
}
@@ -70,6 +70,7 @@
<controls:SettingsExpanderItem
Name="ContentHost"
Padding="{DynamicResource SettingsExpanderPadding}"
Action="{TemplateBinding Action}"
ActionIconSource="{TemplateBinding ActionIconSource}"
ActionTemplate="{TemplateBinding ActionTemplate}"
Background="Transparent"
@@ -152,7 +153,6 @@
Grid.Column="2"
Content="{TemplateBinding Action}"
ContentTemplate="{TemplateBinding ActionTemplate}" />
<Button Grid.Column="2">dsfdsfsdfs</Button>
<Viewbox
Name="ActionIconHost"
Grid.Column="3"