Files
DP44/Common/DTS.CommonCore/Controls/ChannelCodeBuilder.xaml
2026-04-17 14:55:32 -04:00

39 lines
2.5 KiB
XML

<UserControl x:Class="DTS.Common.Controls.ChannelCodeBuilder"
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:DTS.Common.Controls"
xmlns:strings="clr-namespace:DTS.Common.Strings"
xmlns:behaviors="clr-namespace:DTS.Common.Behaviors"
mc:Ignorable="d"
x:Name="dtsChannelCodeBuilder"
d:DesignHeight="450" d:DesignWidth="800" Loaded="ChannelCodeBuilder_OnLoaded"
AutomationProperties.AutomationId="CodeChannelBuilderUserControl"
>
<UserControl.Resources>
<local:CodeTypeToMaxLengthConverter x:Key="CodeTypeToMaxLengthConverter" />
<local:CodeTypeToCharacterCasingConverter x:Key="CodeTypeToCharacterCasingConverter" />
</UserControl.Resources>
<TextBox x:Name="MainEditBox" FontFamily="Courier New" x:FieldModifier="public" HorizontalAlignment="Stretch" DataContext="{Binding ElementName=dtsChannelCodeBuilder}"
MaxLength="{Binding CodeType, Converter={StaticResource CodeTypeToMaxLengthConverter}}"
LostFocus="MainEditBox_OnLostFocus"
GotKeyboardFocus="MainEditBox_OnGotKeyboardFocus"
MouseDoubleClick="MainEditBox_OnMouseDoubleClick"
PreviewKeyDown="MainEditBox_OnPreviewKeyDown"
AutomationProperties.AutomationId="CCB_MainEditTextBox"
behaviors:TextBoxPasteBehavior.PasteCommand="{Binding PasteCommand}"
Binding.SourceUpdated="TextBoxSourceUpdated" CharacterCasing="{Binding ElementName=dtsChannelCodeBuilder,Path=CodeType, Converter={StaticResource CodeTypeToCharacterCasingConverter}}"
TextChanged="MainEditBox_OnTextChanged"
SelectionChanged="MainEditBox_SelectionChanged"
Tag="{Binding Tag}">
<TextBox.Text>
<Binding NotifyOnSourceUpdated="True" Path="Code" UpdateSourceTrigger="PropertyChanged" />
</TextBox.Text>
<TextBox.InputBindings>
<KeyBinding Key="Enter"
Command="{local:UpdatePropertySourceWhenEnterPressed}"
CommandParameter="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type TextBox}}}" />
</TextBox.InputBindings>
</TextBox>
</UserControl>