<SettingsExpander
    x:Class="Wallet.Avalonia.MultilineTextEntryView"
    xmlns="https://github.com/avaloniaui"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:vm="using:Wallet"
    x:DataType="vm:MultilineTextEntryViewModel"
    Header="{Binding Key}"
    IsExpanded="True">
    <TextBox Text="{Binding Value}" TextWrapping="Wrap">
        <TextBox.Styles>
            <Style Selector="TextBox.Write">
                <Setter Property="Height" Value="216" />
                <Setter Property="AcceptsTab" Value="True" />
                <Setter Property="AcceptsReturn" Value="True" />
            </Style>
            <Style Selector="TextBox.Read">
                <Setter Property="Height" Value="216" />
                <Setter Property="IsReadOnly" Value="True" />
                <Setter Property="BorderBrush" Value="Transparent" />
                <Setter Property="Background" Value="Transparent" />
                <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>
    </TextBox>
</SettingsExpander>
