Files
Walleby/Bitvault.Avalonia/ItemHeaderView.axaml
T
2024-05-28 22:41:35 +01:00

53 lines
2.6 KiB
XML

<UserControl
x:Class="Bitvault.Avalonia.ItemHeaderView"
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:vm="using:Bitvault"
x:DataType="vm:ItemHeaderViewModel">
<StackPanel Grid.Column="1" Spacing="18">
<PersonPicture
Width="96"
Height="96"
DisplayName="{Binding Value}" />
<TextBox
MaxWidth="360"
Text="{Binding Value}"
TextAlignment="Center"
Watermark="Enter name">
<Interaction.Behaviors>
<DataTriggerBehavior Binding="{Binding State}" Value="{x:Static vm:ItemState.Read}">
<AddClassAction ClassName="Read" RemoveIfExists="True" />
</DataTriggerBehavior>
<DataTriggerBehavior Binding="{Binding State}" Value="{x:Static vm:ItemState.Write}">
<RemoveClassAction ClassName="Read" />
</DataTriggerBehavior>
</Interaction.Behaviors>
<TextBox.Styles>
<Style Selector="TextBox.Read">
<Setter Property="IsReadOnly" Value="True" />
<Setter Property="BorderBrush" Value="Transparent" />
<Setter Property="Background" Value="Transparent" />
<Style Selector="^:pointerover">
<Setter Property="Foreground" Value="{DynamicResource TextControlForegroundPointerOver}" />
<Style Selector="^ /template/ Border#PART_BorderElement">
<Setter Property="BorderBrush" Value="Transparent" />
<Setter Property="Background" Value="Transparent" />
</Style>
</Style>
<Style Selector="^:focus">
<Setter Property="Foreground" Value="{DynamicResource TextControlForegroundFocused}" />
<Style Selector="^ /template/ TextBlock#PART_Watermark">
<Setter Property="Foreground" Value="{DynamicResource TextControlPlaceholderForegroundFocused}" />
</Style>
<Style Selector="^ /template/ Border#PART_BorderElement">
<Setter Property="Background" Value="Transparent" />
<Setter Property="BorderBrush" Value="Transparent" />
</Style>
</Style>
</Style>
<Style Selector="TextBox.Write" />
</TextBox.Styles>
</TextBox>
</StackPanel>
</UserControl>