mirror of
https://github.com/awatertrevi/xamarin-neo4j.git
synced 2026-09-22 09:05:29 +00:00
AddConnection: add password reveal eye icon toggle
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
xmlns:fonts="clr-namespace:Xamarin.Neo4j.Fonts;assembly=Xamarin.Neo4j"
|
||||
Title="Add Connection"
|
||||
x:Class="Xamarin.Neo4j.Pages.AddConnectionPage">
|
||||
<ContentPage.Content>
|
||||
@@ -35,7 +36,19 @@
|
||||
|
||||
<StackLayout Spacing="4">
|
||||
<Label Text="Password:" FontAttributes="Bold" FontSize="Small" />
|
||||
<Entry Text="{Binding Password}" IsPassword="True" />
|
||||
<Grid ColumnDefinitions="*,Auto">
|
||||
<Entry Grid.Column="0" x:Name="passwordEntry"
|
||||
Text="{Binding Password}"
|
||||
IsPassword="True" />
|
||||
<Button Grid.Column="1" x:Name="eyeButton"
|
||||
Text="{x:Static fonts:FontAwesomeSolid.Eye}"
|
||||
FontFamily="{StaticResource FontAwesomeSolid}"
|
||||
FontSize="16"
|
||||
WidthRequest="44"
|
||||
BackgroundColor="Transparent"
|
||||
TextColor="{DynamicResource SecondaryTextColor}"
|
||||
Clicked="TogglePasswordVisibility" />
|
||||
</Grid>
|
||||
</StackLayout>
|
||||
|
||||
<Button Text="Connect" BackgroundColor="#2DB4A8" TextColor="White" Command="{Binding Commands[Connect]}" />
|
||||
|
||||
@@ -6,6 +6,7 @@ using System.Threading.Tasks;
|
||||
|
||||
using Microsoft.Maui.Controls;
|
||||
using Microsoft.Maui.Controls.Xaml;
|
||||
using Xamarin.Neo4j.Fonts;
|
||||
using Xamarin.Neo4j.Models;
|
||||
using Xamarin.Neo4j.ViewModels;
|
||||
|
||||
@@ -14,11 +15,20 @@ namespace Xamarin.Neo4j.Pages
|
||||
[XamlCompilation(XamlCompilationOptions.Compile)]
|
||||
public partial class AddConnectionPage : ContentPage
|
||||
{
|
||||
private bool _passwordVisible = false;
|
||||
|
||||
public AddConnectionPage(Neo4jConnectionString neo4JConnectionString = null)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
BindingContext = new AddConnectionViewModel(Navigation, neo4JConnectionString);
|
||||
}
|
||||
|
||||
private void TogglePasswordVisibility(object sender, System.EventArgs e)
|
||||
{
|
||||
_passwordVisible = !_passwordVisible;
|
||||
passwordEntry.IsPassword = !_passwordVisible;
|
||||
eyeButton.Text = _passwordVisible ? FontAwesomeSolid.EyeSlash : FontAwesomeSolid.Eye;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user