Files
EgtWPFLib5/EgtTextBox.xaml
T
Renzo Lanza c06857d6cb EgtWPFLib5:
- nuova EgtTextBox (TextBlock con Border in lettura che diventa temporaneamente TextBox solo in caso di edit del testo)
2020-12-11 11:08:18 +00:00

77 lines
3.8 KiB
XML

<UserControl x:Class="EgtTextBox"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:EgtWPFLib5"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<UserControl.Resources>
<LinearGradientBrush x:Key="TextBoxBorder" EndPoint="0,20" MappingMode="Absolute" StartPoint="0,0">
<GradientStop Color="#ABADB3" Offset="0.05"/>
<GradientStop Color="#E2E3EA" Offset="0.07"/>
<GradientStop Color="#E3E9EF" Offset="1"/>
</LinearGradientBrush>
</UserControl.Resources>
<Grid>
<Border Name="Brd"
BorderThickness="1"
Padding="1"
AllowDrop="true"
FocusVisualStyle="{x:Null}"
ScrollViewer.PanningMode="VerticalFirst"
Stylus.IsFlicksEnabled="False" >
<Border.Style>
<Style TargetType="Border">
<Style.Triggers>
<Trigger Property="IsEnabled" Value="True">
<Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.WindowBrushKey}}"/>
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}"/>
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="BorderBrush" Value="#FF7EB4EA"/>
<Setter Property="Cursor" Value="IBeam"/>
</Trigger>
<Trigger Property="IsMouseOver" Value="False">
<Setter Property="BorderBrush" Value="{StaticResource TextBoxBorder}"/>
<Setter Property="Cursor" Value="Arrow"/>
</Trigger>
<Trigger Property="IsKeyboardFocused" Value="True">
<Setter Property="BorderBrush" Value="#FF569DE5"/>
</Trigger>
</Style.Triggers>
</Style>
</Border.Style>
<TextBlock Name="TxBl"
Visibility="Visible"
Padding="2,0,2,0">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Style.Triggers>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}"/>
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
</Trigger>
<Trigger Property="IsEnabled" Value="True">
<Setter Property="Background" Value="White"/>
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
</Trigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
</Border>
<TextBox Name="TxBx"
Visibility="Hidden"
Padding="1,1,1,0"
Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
</Grid>
</UserControl>