AITBarcodeTextBox.xaml 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <UserControl x:Class="Aitex.Core.UI.DeviceControl.AITBarcodeTextBox"
  2. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  3. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  4. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  5. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  6. mc:Ignorable="d" d:DesignHeight="35" d:DesignWidth="300" x:Name="self">
  7. <Grid HorizontalAlignment="Stretch" Margin="0">
  8. <TextBox Foreground="White" FontSize="30" AcceptsReturn="True" InputMethod.PreferredImeState="Off"
  9. InputMethod.IsInputMethodEnabled="False" Text="{Binding ElementName=self, Path=BarcodeText}" TextChanged="TextBoxBase_OnTextChanged" PreviewTextInput="UIElement_OnPreviewTextInput" TabIndex="0" BorderThickness="1" Margin="0" Padding="0" HorizontalAlignment="Stretch" TextAlignment="Center" VerticalContentAlignment="Center" >
  10. <TextBox.Background>
  11. <ImageBrush Stretch="Fill" x:Name="BarcodeBrushName" Opacity="0.1" AlignmentX="Center" AlignmentY="Center">
  12. <ImageBrush.ImageSource>
  13. <BitmapImage UriSource="/MECF.Framework.Common;component/Resources/barcode.png"/>
  14. </ImageBrush.ImageSource>
  15. </ImageBrush>
  16. </TextBox.Background>
  17. <TextBox.Triggers>
  18. <EventTrigger RoutedEvent="TextBox.GotFocus">
  19. <BeginStoryboard>
  20. <Storyboard>
  21. <DoubleAnimation Storyboard.TargetName="BarcodeBrushName" Storyboard.TargetProperty="Opacity" AutoReverse="True" RepeatBehavior="Forever"
  22. From="0" To="0.3" Duration="0:0:0.5" />
  23. </Storyboard>
  24. </BeginStoryboard>
  25. </EventTrigger>
  26. <EventTrigger RoutedEvent="TextBox.LostFocus">
  27. <BeginStoryboard>
  28. <Storyboard>
  29. <DoubleAnimation Storyboard.TargetName="BarcodeBrushName" Storyboard.TargetProperty="Opacity" AutoReverse="False" From="0.3" To="0.1" Duration="0:0:0.1" />
  30. </Storyboard>
  31. </BeginStoryboard>
  32. </EventTrigger>
  33. </TextBox.Triggers>
  34. </TextBox>
  35. </Grid>
  36. </UserControl>