回答編集履歴

1

追記しました。

2017/02/28 02:06

投稿

hihijiji
hihijiji

スコア4150

test CHANGED
@@ -3,3 +3,51 @@
3
3
 
4
4
 
5
5
  AllowDrop="True"
6
+
7
+
8
+
9
+ ---- 追記 ---
10
+
11
+ ちょっと読み違いをしてましたm(_ _)m
12
+
13
+ お詫び代わりに私だったら、こう書くってXAMLを載せときます。
14
+
15
+ MVVMです。
16
+
17
+ ``` XAML
18
+
19
+ <TextBox Text="{Binding MyText}" Name="myTextBox" Width="150">
20
+
21
+ <TextBox.InputBindings>
22
+
23
+ <KeyBinding Gesture="Shift+Insert" Command="{Binding PasteCommand}"/>
24
+
25
+ <KeyBinding Gesture="Ctrl+V" Command="{Binding PasteCommand}"/>
26
+
27
+ </TextBox.InputBindings>
28
+
29
+ <TextBox.ContextMenu>
30
+
31
+ <ContextMenu>
32
+
33
+ <MenuItem Header="切り取り" Command="{Binding CutCommand}"
34
+
35
+ CommandParameter="{Binding RelativeSource={RelativeSource
36
+
37
+ AncestorType=TextBox},Path=SelectedText}"/>
38
+
39
+ <MenuItem Header="コピー" Command="{Binding CopyCommand}"
40
+
41
+ CommandParameter="{Binding RelativeSource={RelativeSource
42
+
43
+ AncestorType=TextBox},Path=SelectedText}"/>
44
+
45
+ <MenuItem Header="貼り付け" Command="{Binding PastCommand}"/>
46
+
47
+ </ContextMenu>
48
+
49
+ </TextBox.ContextMenu>
50
+
51
+ </TextBox>
52
+
53
+ ```