Files
Walleby/Wallet.Avalonia/MaskedTextEntryView.axaml
T
2024-06-27 21:00:33 +01:00

75 lines
4.1 KiB
XML

<SettingsExpander
x:Class="Wallet.Avalonia.MaskedTextEntryView"
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:vm="using:Wallet"
x:DataType="vm:MaskedTextEntryViewModel"
Header="{Binding Key}"
IsExpanded="False">
<SettingsExpander.Resources>
<Thickness x:Key="TextControlThemePadding">10,5,6,6</Thickness>
<Thickness x:Key="TextControlCompactThemePadding">0</Thickness>
</SettingsExpander.Resources>
<SettingsExpander.Footer>
<MaskedTextBox Mask="{Binding Pattern}" Text="{Binding Value}">
<TextBox.Styles>
<Style Selector="TextBox.Write">
<Setter Property="MaxWidth" Value="{Binding Width}" />
<Setter Property="MinWidth" Value="{Binding Width}" />
<Setter Property="Padding" Value="{StaticResource TextControlThemePadding}" />
<Setter Property="TextWrapping" Value="NoWrap" />
</Style>
<Style Selector="TextBox.Read">
<Setter Property="MinWidth" Value="0" />
<Setter Property="IsReadOnly" Value="True" />
<Setter Property="BorderBrush" Value="Transparent" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="Padding" Value="{StaticResource TextControlCompactThemePadding}" />
<Setter Property="MinHeight" Value="0" />
<Setter Property="TextWrapping" Value="Wrap" />
<Setter Property="Foreground">
<Setter.Value>
<SolidColorBrush Opacity="0.7" Color="{DynamicResource TextFillColorPrimary}" />
</Setter.Value>
</Setter>
<Style Selector="^:pointerover">
<Setter Property="Foreground">
<Setter.Value>
<SolidColorBrush Opacity="0.7" Color="{DynamicResource TextFillColorPrimary}" />
</Setter.Value>
</Setter>
<Style Selector="^ /template/ Border#PART_BorderElement">
<Setter Property="BorderBrush" Value="Transparent" />
<Setter Property="Background" Value="Transparent" />
</Style>
</Style>
<Style Selector="^:focus">
<Setter Property="Foreground">
<Setter.Value>
<SolidColorBrush Opacity="0.7" Color="{DynamicResource TextFillColorPrimary}" />
</Setter.Value>
</Setter>
<Style Selector="^ /template/ Border#PART_BorderElement">
<Setter Property="Background" Value="Transparent" />
<Setter Property="BorderBrush" Value="Transparent" />
</Style>
</Style>
</Style>
</TextBox.Styles>
<Interaction.Behaviors>
<DataTriggerBehavior Binding="{Binding State}" Value="{x:Static vm:ItemState.Read}">
<AddClassAction ClassName="Read" RemoveIfExists="True" />
<RemoveClassAction ClassName="Write" />
</DataTriggerBehavior>
<DataTriggerBehavior Binding="{Binding State}" Value="{x:Static vm:ItemState.New}">
<AddClassAction ClassName="Write" RemoveIfExists="True" />
<RemoveClassAction ClassName="Read" />
</DataTriggerBehavior>
<DataTriggerBehavior Binding="{Binding State}" Value="{x:Static vm:ItemState.Write}">
<AddClassAction ClassName="Write" RemoveIfExists="True" />
<RemoveClassAction ClassName="Read" />
</DataTriggerBehavior>
</Interaction.Behaviors>
</MaskedTextBox>
</SettingsExpander.Footer>
</SettingsExpander>