<UserControl
    x:Class="Wallet.Avalonia.OpenWalletView"
    xmlns="https://github.com/avaloniaui"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:vm="using:Wallet"
    x:DataType="vm:OpenWalletViewModel">
    <StackPanel
        HorizontalAlignment="Center"
        VerticalAlignment="Center"
        IsEnabled="{Binding !IsActive}"
        Spacing="12">
        <PersonPicture
            Width="144"
            Height="144"
            DisplayName="{Binding Name}"
            ProfilePicture="{Binding ImageDescriptor.Image}" />
        <TextBlock
            Text="{Binding Name}"
            TextAlignment="Center"
            Theme="{DynamicResource SubtitleTextBlockStyle}" />
        <TextBox
            Width="360"
            Classes="revealPasswordButton"
            PasswordChar="&#x25CF;"
            Text="{Binding Password}"
            Watermark="Password">
            <Interaction.Behaviors>
                <KeyBindingTriggerBehaviour Gesture="Enter" IsEnabled="{Binding Password, Converter={x:Static StringConverters.IsNotNullOrEmpty}}">
                    <InvokeCommandAction Command="{Binding InvokeCommand}" />
                </KeyBindingTriggerBehaviour>
            </Interaction.Behaviors>
        </TextBox>
        <Grid>
            <TextBlock HorizontalAlignment="Center" Text="{ReflectionBinding Validation.Errors[Password]}" />
            <ProgressRing
                HorizontalAlignment="Center"
                VerticalAlignment="Center"
                IsActive="{Binding IsActive}" />
        </Grid>
    </StackPanel>
</UserControl>
