Skip to content

Commit 6d2486d

Browse files
author
Sébastien Geiser
committed
ContextMenu copy
1 parent 7224171 commit 6d2486d

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

RegexDialog/RegExToolDialog.xaml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,19 +41,28 @@
4141
<BitmapImage x:Key="Play" UriSource="Resources/control_play_blue.png"/>
4242
<BitmapImage x:Key="VS" UriSource="Resources/visual_studio_purple.png"/>
4343

44+
<ContextMenu x:Key="JustCopyContextMenu">
45+
<MenuItem Header="Copy" Command="ApplicationCommands.Copy" />
46+
</ContextMenu>
47+
4448
<Style TargetType="{x:Type local:SearchableTextControl}">
4549
<Setter Property="Template">
4650
<Setter.Value>
4751
<ControlTemplate TargetType="{x:Type local:SearchableTextControl}">
4852
<Border Background="{TemplateBinding Background}"
49-
BorderBrush="{TemplateBinding BorderBrush}"
50-
BorderThickness="{TemplateBinding BorderThickness}"
51-
Padding="{TemplateBinding Padding}">
53+
BorderBrush="{TemplateBinding BorderBrush}"
54+
BorderThickness="{TemplateBinding BorderThickness}"
55+
Padding="{TemplateBinding Padding}">
5256
<TextBlock TextWrapping="Wrap" x:Name="PART_TEXT"/>
5357
</Border>
5458
</ControlTemplate>
5559
</Setter.Value>
5660
</Setter>
61+
<Style.Triggers>
62+
<Trigger Property="IsSelectable" Value="True">
63+
<Setter Property="ContextMenu" Value="{StaticResource JustCopyContextMenu}"/>
64+
</Trigger>
65+
</Style.Triggers>
5766
</Style>
5867

5968
<Style TargetType="Image">

RegexDialog/SearchableTextControl.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e)
9292
ResetSelectionTextRange();
9393
Point mouseDownPoint = e.GetPosition(this);
9494
StartSelectPosition = displayTextBlock.GetPositionFromPoint(mouseDownPoint, true);
95+
EndSelectPosition = StartSelectPosition;
9596
isSelecting = true;
9697
}
9798
}

0 commit comments

Comments
 (0)