回答編集履歴
1
見直しキャンペーン中
test
CHANGED
@@ -1,63 +1,32 @@
|
|
1
1
|
意味的にはこれで十分でしょうか。
|
2
|
-
|
3
|
-
```
|
2
|
+
```cs
|
4
|
-
|
5
3
|
var element = Keyboard.FocusedElement as UIElement;
|
6
|
-
|
7
4
|
element?.MoveFocus(new TraversalRequest(direction));
|
8
|
-
|
9
5
|
```
|
10
|
-
|
11
6
|
とか
|
12
|
-
|
13
|
-
```
|
7
|
+
```cs
|
14
|
-
|
15
8
|
var element = e.OriginalSource as UIElement;
|
16
|
-
|
17
9
|
element?.MoveFocus(new TraversalRequest(direction));
|
18
|
-
|
19
10
|
```
|
20
|
-
|
21
|
-
|
22
11
|
|
23
12
|
---
|
24
13
|
|
25
14
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
```
|
15
|
+
```cs
|
30
|
-
|
31
16
|
var element = FocusManager.GetFocusedElement(this) as UIElement;
|
32
|
-
|
33
17
|
element?.MoveFocus(new TraversalRequest(direction));
|
34
|
-
|
18
|
+
```
|
19
|
+
としたい場合は`FocusScope`の設定がいるようです(よくわかってません
|
20
|
+
```xml
|
21
|
+
<UserControl FocusManager.IsFocusScope="True" />
|
22
|
+
```
|
23
|
+
or
|
24
|
+
```cs
|
25
|
+
public TestControl()
|
26
|
+
{
|
27
|
+
InitializeComponent();
|
28
|
+
FocusManager.SetIsFocusScope(this, true);
|
29
|
+
}
|
35
30
|
```
|
36
31
|
|
37
|
-
としたい場合は`FocusScope`の設定がいるようです(よくわかってません
|
38
|
-
|
39
|
-
```xaml
|
40
|
-
|
41
|
-
<UserControl FocusManager.IsFocusScope="True" />
|
42
|
-
|
43
|
-
```
|
44
|
-
|
45
|
-
or
|
46
|
-
|
47
|
-
```C#
|
48
|
-
|
49
|
-
public TestControl()
|
50
|
-
|
51
|
-
{
|
52
|
-
|
53
|
-
InitializeComponent();
|
54
|
-
|
55
|
-
FocusManager.SetIsFocusScope(this, true);
|
56
|
-
|
57
|
-
}
|
58
|
-
|
59
|
-
```
|
60
|
-
|
61
|
-
|
62
|
-
|
63
32
|
[フォーカスの概要 - WPF | Microsoft Docs](https://docs.microsoft.com/ja-jp/dotnet/framework/wpf/advanced/focus-overview)
|