ApplicationCommands.Cut not reacting on selection in TextBox
Posted: 05 Jun 2023, 14:54
Hi,
I have a trouble with ApplicationCommands.Cut and ApplicationCommands.Copy. Buttons with this commands don't become active when i select text in textbox before i call context menu with right click. But all works great in wpf: when click "Select All" or select text by mouse, button "Cut" dynamically makes active.
Xaml:
I have a trouble with ApplicationCommands.Cut and ApplicationCommands.Copy. Buttons with this commands don't become active when i select text in textbox before i call context menu with right click. But all works great in wpf: when click "Select All" or select text by mouse, button "Cut" dynamically makes active.
Xaml:
Code: Select all
<StackPanel
Grid.Row="0"
Margin="0,0,0,10"
Orientation="Horizontal">
<Button
Command="ApplicationCommands.SelectAll"
CommandTarget="{Binding ElementName=KeyboardTextBox}"
Style="{StaticResource EditButtonStyle}">
<TextBlock Style="{StaticResource EditButtonTextStyle}" Text="Select all" />
</Button>
<Button
Command="ApplicationCommands.Cut"
CommandTarget="{Binding ElementName=KeyboardTextBox}"
Style="{StaticResource EditButtonStyle}">
<TextBlock Style="{StaticResource EditButtonTextStyle}" Text="Cut" />
</Button>
...
</StackPanel>
...
<TextBox
x:Name="KeyboardTextBox"
MaxWidth="{Binding ElementName=itemsControl, Path=ActualWidth}"
MaxHeight="90"
Margin="8,8,8,0"
kbdAtt:FocusExtension.IsFocused="{Binding IsVisible}"
Focusable="True"
FontFamily="Jura"
FontSize="29"
FontWeight="SemiBold"
IsReadOnly="False"
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
ScrollViewer.VerticalScrollBarVisibility="Auto"
SelectionBrush="{StaticResource Brush.Alarm}"
TextWrapping="Wrap" />