回答編集履歴

1

見直しキャンペーン中

2023/07/21 13:54

投稿

TN8001
TN8001

スコア9862

test CHANGED
@@ -1,151 +1,76 @@
1
1
  (そうじゃないと言われそうな気もしますが)これでいいですか?
2
2
 
3
-
4
-
5
- ```xaml
3
+ ```xml
6
-
7
4
  <Window
8
-
9
5
  x:Class="Questions259769.MainWindow"
10
-
11
6
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
12
-
13
7
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
14
-
15
8
  Width="800"
16
-
17
9
  Height="450">
18
-
19
10
  <Canvas Margin="10" Background="AliceBlue">
20
-
21
11
  <Thumb
22
-
23
12
  x:Name="thumb"
24
-
25
13
  Height="150"
26
-
27
14
  DragCompleted="Thumb_DragCompleted"
28
-
29
15
  DragDelta="Thumb_DragDelta"
30
-
31
16
  DragStarted="Thumb_DragStarted">
32
-
33
17
  <Thumb.Template>
34
-
35
18
  <ControlTemplate>
36
-
37
19
  <Border x:Name="Thumb_Border" BorderBrush="Red">
38
-
39
20
  <DataGrid AutoGenerateColumns="False" ItemsSource="{Binding}">
40
-
41
21
  <DataGrid.Columns>
42
-
43
22
  <DataGridTextColumn Binding="{Binding Name}" Header="Name" />
44
-
45
23
  <DataGridTextColumn Binding="{Binding Gender}" Header="Gender" />
46
-
47
24
  <DataGridTextColumn Binding="{Binding Age}" Header="Age" />
48
-
49
25
  <DataGridTextColumn Binding="{Binding AuthMember}" Header="AuthMember" />
50
-
51
26
  </DataGrid.Columns>
52
-
53
27
  </DataGrid>
54
-
55
28
  </Border>
56
-
57
29
  </ControlTemplate>
58
-
59
30
  </Thumb.Template>
60
-
61
31
  </Thumb>
62
-
63
32
  </Canvas>
64
-
65
33
  </Window>
66
-
67
34
  ```
68
35
 
69
-
70
-
71
- ```C#
36
+ ```cs
72
-
73
37
  using System.Collections.ObjectModel;
74
-
75
38
  using System.Linq;
76
-
77
39
  using System.Windows;
78
-
79
40
  using System.Windows.Controls.Primitives;
80
41
 
81
-
82
-
83
42
  namespace Questions259769
84
-
85
43
  {
86
-
87
44
  public partial class MainWindow : Window
88
-
89
45
  {
90
-
91
46
  public MainWindow()
92
-
93
47
  {
94
-
95
48
  InitializeComponent();
96
49
 
97
-
98
-
99
50
  thumb.DataContext = new ObservableCollection<Person>(
100
-
101
51
  Enumerable.Range(1, 100).Select(i => new Person
102
-
103
52
  {
104
-
105
53
  Name = "田中 太郎" + i,
106
-
107
54
  Gender = i % 2 == 0 ? Gender.Men : Gender.Women,
108
-
109
55
  Age = 20 + i % 50,
110
-
111
56
  AuthMember = i % 5 == 0
112
-
113
57
  }));
114
-
115
58
  }
116
59
 
117
-
118
-
119
60
  private void Thumb_DragCompleted(object sender, DragCompletedEventArgs e) { }
120
-
121
61
  private void Thumb_DragDelta(object sender, DragDeltaEventArgs e) { }
122
-
123
62
  private void Thumb_DragStarted(object sender, DragStartedEventArgs e) { }
124
-
125
-
126
63
 
127
64
  public enum Gender { None, Men, Women, }
128
65
 
129
-
130
-
131
66
  public class Person
132
-
133
67
  {
134
-
135
68
  public string Name { get; set; }
136
-
137
69
  public Gender Gender { get; set; }
138
-
139
70
  public int Age { get; set; }
140
-
141
71
  public bool AuthMember { get; set; }
142
-
143
72
  }
144
-
145
73
  }
146
-
147
74
  }
148
-
149
75
  ```
150
-
151
76
  ![アプリ画像](4b35dd31d8409893f9424271cc8f0049.png)