1234567891011121314151617181920212223242526272829303132333435 |
- <UserControl x:Class="MECF.Framework.UI.Core.Control.PMCounterValueTextBox"
- 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:MECF.Framework.UI.Core.Control"
- xmlns:converters="clr-namespace:MECF.Framework.UI.Core.Converters"
- mc:Ignorable="d" x:Name="self"
- d:DesignHeight="35" d:DesignWidth="200">
- <UserControl.Resources>
- <converters:NumberStringToBool x:Key="numberStringToBool"/>
- <converters:StringToVisibility x:Key="stringToVisibility"/>
-
- <Style TargetType="TextBox" x:Key="CustomStyle">
- <Style.Triggers>
- <DataTrigger Binding="{Binding ElementName=self,Path=Value}" Value="Value">
- <Setter Property="Background" Value="#FFDAE5F1"/>
- <Setter Property="BorderThickness" Value="0"/>
- </DataTrigger>
- </Style.Triggers>
- </Style>
- </UserControl.Resources>
- <TextBox Name="txtInput" VerticalContentAlignment="Center"
- Text="{Binding ElementName=self,Path=Value,Mode=TwoWay}"
- IsReadOnly="{Binding ElementName=self,Path=Value,Converter={StaticResource numberStringToBool}}"
- PreviewTextInput="OnPreviewTextInput"
- InputMethod.IsInputMethodEnabled="False"
- KeyDown="TextBox_KeyDown"
- Width="200" HorizontalAlignment="Center" HorizontalContentAlignment="Center" VerticalAlignment="Center"
- Visibility="{Binding ElementName=self,Path=Value,Converter={StaticResource stringToVisibility}}"
- LostFocus="TextBox_LostFocus"
- Style="{StaticResource CustomStyle}"/>
- </UserControl>
|