回答編集履歴

1

インデント修正

2023/10/11 00:57

投稿

hqf00342
hqf00342

スコア394

test CHANGED
@@ -2,10 +2,10 @@
2
2
  `e.OriginalSource` にイベント元のコントロールが入ってないでしょうか。
3
3
 
4
4
  ```csharp
5
- private void TabControl_SelectionChanged(object sender, SelectionChangedEventArgs e)
5
+ private void TabControl_SelectionChanged(object sender, SelectionChangedEventArgs e)
6
- {
6
+ {
7
- var tabControl = e.OriginalSource as TabControl;
7
+ var tabControl = e.OriginalSource as TabControl;
8
- var selectedIndex = tabControl.SelectedIndex;
8
+ var selectedIndex = tabControl.SelectedIndex;
9
- System.Diagnostics.Debug.Print($"{tabControl.Name} {selectedIndex}");
9
+ System.Diagnostics.Debug.Print($"{tabControl.Name} {selectedIndex}");
10
- }
10
+ }
11
11
  ```