回答編集履歴
2
見直しキャンペーン中
test
CHANGED
@@ -1,423 +1,212 @@
|
|
1
1
|
参考にしたサイトかなんかがあるのでしたら、一緒に提示してください。
|
2
2
|
|
3
|
-
|
4
|
-
|
5
3
|
#### エラー原因
|
6
|
-
|
7
4
|
###### 1個目
|
8
5
|
|
9
|
-
|
10
|
-
|
11
|
-
```
|
6
|
+
```xml
|
12
|
-
|
13
7
|
<ComboBox x:Name="ChangeYEAR" SelectionChanged="ChangYEAR_SelectionChanged"/>
|
14
|
-
|
15
|
-
```
|
8
|
+
```
|
16
|
-
|
17
9
|
xamlに↑のような表記があるのに
|
18
|
-
|
19
|
-
```
|
10
|
+
```cs
|
20
|
-
|
21
11
|
private void ChangYEAR_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
22
|
-
|
23
12
|
{
|
24
|
-
|
25
13
|
}
|
26
|
-
|
27
|
-
```
|
14
|
+
```
|
28
|
-
|
29
15
|
csに↑のようなメソッドがないため。
|
30
16
|
|
31
|
-
|
32
|
-
|
33
17
|
###### 2個目
|
34
|
-
|
35
|
-
コンボボックス`ChangeYEAR`
|
18
|
+
コンボボックス`ChangeYEAR`・`ChangeMONTH`に、`GetYear()`・`getmonth()`のようなメソッドがないため。
|
36
|
-
|
37
|
-
|
38
19
|
|
39
20
|
---
|
40
21
|
|
41
|
-
|
42
|
-
|
43
22
|
とりあえず元コードを尊重しながら動くようにしました。
|
44
|
-
|
45
23
|
xamlがわからないのででっち上げましたが、構造は気にしないでいいです。
|
46
|
-
|
47
|
-
```x
|
24
|
+
```xml
|
48
|
-
|
49
25
|
<ComboBox x:Name="ChangeYEAR" SelectionChanged="SelectionChanged" />
|
50
|
-
|
51
|
-
```
|
26
|
+
```
|
52
|
-
|
53
27
|
のように名前とイベントの対応があっていれば十分です。
|
54
28
|
|
55
|
-
|
56
|
-
|
57
|
-
```x
|
29
|
+
```xml
|
58
|
-
|
59
30
|
<Window
|
60
|
-
|
61
31
|
x:Class="Questions259221.MainWindow"
|
62
|
-
|
63
32
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
64
|
-
|
65
33
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
66
|
-
|
67
34
|
Width="800"
|
68
|
-
|
69
35
|
Height="450">
|
70
|
-
|
71
36
|
<StackPanel>
|
72
|
-
|
73
37
|
<StackPanel Orientation="Horizontal">
|
74
|
-
|
75
38
|
<ComboBox
|
76
|
-
|
77
39
|
x:Name="ChangeYEAR"
|
78
|
-
|
79
40
|
Width="100"
|
80
|
-
|
81
41
|
SelectionChanged="SelectionChanged" />
|
82
|
-
|
83
42
|
<ComboBox
|
84
|
-
|
85
43
|
x:Name="ChangeMONTH"
|
86
|
-
|
87
44
|
Width="100"
|
88
|
-
|
89
45
|
SelectionChanged="SelectionChanged" />
|
90
|
-
|
91
46
|
<Button
|
92
|
-
|
93
47
|
x:Name="Today"
|
94
|
-
|
95
48
|
Click="Today_Click"
|
96
|
-
|
97
49
|
Content="Today" />
|
98
|
-
|
99
50
|
</StackPanel>
|
100
|
-
|
101
51
|
|
102
|
-
|
103
52
|
<UniformGrid
|
104
|
-
|
105
53
|
Width="300"
|
106
|
-
|
107
54
|
Height="300"
|
108
|
-
|
109
55
|
HorizontalAlignment="Left"
|
110
|
-
|
111
56
|
VerticalAlignment="Top"
|
112
|
-
|
113
57
|
Columns="7">
|
114
58
|
|
115
|
-
|
116
|
-
|
117
59
|
<Label Content="Sun" />
|
118
|
-
|
119
60
|
<Label Content="Mon" />
|
120
|
-
|
121
61
|
<Label Content="Tue" />
|
122
|
-
|
123
62
|
<Label Content="Wed" />
|
124
|
-
|
125
63
|
<Label Content="Thu" />
|
126
|
-
|
127
64
|
<Label Content="Fri" />
|
128
|
-
|
129
65
|
<Label Content="Sat" />
|
130
66
|
|
131
|
-
|
132
|
-
|
133
67
|
<Label x:Name="Su1" />
|
134
|
-
|
135
68
|
<Label x:Name="Mo1" />
|
136
|
-
|
137
69
|
<Label x:Name="Tu1" />
|
138
|
-
|
139
70
|
<Label x:Name="We1" />
|
140
|
-
|
141
71
|
<Label x:Name="Th1" />
|
142
|
-
|
143
72
|
<Label x:Name="Fr1" />
|
144
|
-
|
145
73
|
<Label x:Name="Sa1" />
|
146
74
|
|
147
|
-
|
148
|
-
|
149
75
|
<Label x:Name="Su2" />
|
150
|
-
|
151
76
|
<Label x:Name="Mo2" />
|
152
|
-
|
153
77
|
<Label x:Name="Tu2" />
|
154
|
-
|
155
78
|
<Label x:Name="We2" />
|
156
|
-
|
157
79
|
<Label x:Name="Th2" />
|
158
|
-
|
159
80
|
<Label x:Name="Fr2" />
|
160
|
-
|
161
81
|
<Label x:Name="Sa2" />
|
162
82
|
|
163
|
-
|
164
|
-
|
165
83
|
<Label x:Name="Su3" />
|
166
|
-
|
167
84
|
<Label x:Name="Mo3" />
|
168
|
-
|
169
85
|
<Label x:Name="Tu3" />
|
170
|
-
|
171
86
|
<Label x:Name="We3" />
|
172
|
-
|
173
87
|
<Label x:Name="Th3" />
|
174
|
-
|
175
88
|
<Label x:Name="Fr3" />
|
176
|
-
|
177
89
|
<Label x:Name="Sa3" />
|
178
90
|
|
179
|
-
|
180
|
-
|
181
91
|
<Label x:Name="Su4" />
|
182
|
-
|
183
92
|
<Label x:Name="Mo4" />
|
184
|
-
|
185
93
|
<Label x:Name="Tu4" />
|
186
|
-
|
187
94
|
<Label x:Name="We4" />
|
188
|
-
|
189
95
|
<Label x:Name="Th4" />
|
190
|
-
|
191
96
|
<Label x:Name="Fr4" />
|
192
|
-
|
193
97
|
<Label x:Name="Sa4" />
|
194
98
|
|
195
|
-
|
196
|
-
|
197
99
|
<Label x:Name="Su5" />
|
198
|
-
|
199
100
|
<Label x:Name="Mo5" />
|
200
|
-
|
201
101
|
<Label x:Name="Tu5" />
|
202
|
-
|
203
102
|
<Label x:Name="We5" />
|
204
|
-
|
205
103
|
<Label x:Name="Th5" />
|
206
|
-
|
207
104
|
<Label x:Name="Fr5" />
|
208
|
-
|
209
105
|
<Label x:Name="Sa5" />
|
210
106
|
|
211
|
-
|
212
|
-
|
213
107
|
<Label x:Name="Su6" />
|
214
|
-
|
215
108
|
<Label x:Name="Mo6" />
|
216
|
-
|
217
109
|
<Label x:Name="Tu6" />
|
218
|
-
|
219
110
|
<Label x:Name="We6" />
|
220
|
-
|
221
111
|
<Label x:Name="Th6" />
|
222
|
-
|
223
112
|
<Label x:Name="Fr6" />
|
224
|
-
|
225
113
|
<Label x:Name="Sa6" />
|
226
|
-
|
227
114
|
</UniformGrid>
|
228
|
-
|
229
115
|
</StackPanel>
|
230
|
-
|
231
116
|
</Window>
|
232
|
-
|
233
|
-
```
|
117
|
+
```
|
234
|
-
|
235
|
-
|
236
118
|
|
237
119
|
```cs
|
238
|
-
|
239
120
|
using System;
|
240
|
-
|
241
121
|
using System.Collections.Generic;
|
242
|
-
|
243
122
|
using System.Windows;
|
244
|
-
|
245
123
|
using System.Windows.Controls;
|
246
124
|
|
247
|
-
|
248
|
-
|
249
125
|
namespace Questions259221
|
250
|
-
|
251
126
|
{
|
252
|
-
|
253
127
|
public partial class MainWindow : Window
|
254
|
-
|
255
128
|
{
|
256
|
-
|
257
129
|
private bool combbox_change = true;
|
258
|
-
|
259
130
|
private List<Label> test;
|
260
131
|
|
261
|
-
|
262
|
-
|
263
132
|
public MainWindow()
|
264
|
-
|
265
133
|
{
|
266
|
-
|
267
134
|
InitializeComponent();
|
268
135
|
|
269
|
-
|
270
|
-
|
271
136
|
DateTime now = DateTime.Now;
|
272
137
|
|
273
|
-
|
274
|
-
|
275
138
|
List<int> years = new List<int>();
|
276
|
-
|
277
139
|
for(int i = now.Year - 10; i <= now.Year + 10; i++)
|
278
|
-
|
279
140
|
{
|
280
|
-
|
281
141
|
years.Add(i);
|
282
|
-
|
283
142
|
}
|
284
|
-
|
285
143
|
int[] month = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 };
|
286
144
|
|
287
145
|
|
288
|
-
|
289
|
-
|
290
|
-
|
291
146
|
// ラベルリストの初期化&中身
|
292
|
-
|
293
147
|
test = new List<Label>
|
294
|
-
|
295
148
|
{
|
296
|
-
|
297
149
|
Su1, Mo1, Tu1, We1, Th1, Fr1, Sa1,
|
298
|
-
|
299
150
|
Su2, Mo2, Tu2, We2, Th2, Fr2, Sa2,
|
300
|
-
|
301
151
|
Su3, Mo3, Tu3, We3, Th3, Fr3, Sa3,
|
302
|
-
|
303
152
|
Su4, Mo4, Tu4, We4, Th4, Fr4, Sa4,
|
304
|
-
|
305
153
|
Su5, Mo5, Tu5, We5, Th5, Fr5, Sa5,
|
306
|
-
|
307
154
|
Su6, Mo6, Tu6, We6, Th6, Fr6, Sa6,
|
308
|
-
|
309
155
|
};
|
310
156
|
|
311
|
-
|
312
|
-
|
313
157
|
ChangeYEAR.ItemsSource = years;
|
314
|
-
|
315
158
|
ChangeMONTH.ItemsSource = month;
|
316
159
|
|
317
|
-
|
318
|
-
|
319
160
|
combbox_change = false;
|
320
|
-
|
321
161
|
ChangeYEAR.SelectedItem = now.Year;
|
322
|
-
|
323
162
|
combbox_change = true;
|
324
|
-
|
325
163
|
ChangeMONTH.SelectedItem = now.Month;
|
326
|
-
|
327
164
|
}
|
328
165
|
|
329
|
-
|
330
|
-
|
331
166
|
private void SelectionChanged(object sender, SelectionChangedEventArgs e)
|
332
|
-
|
333
167
|
{
|
334
|
-
|
335
168
|
if(combbox_change != true) return;
|
336
169
|
|
337
|
-
|
338
|
-
|
339
170
|
// 一旦全ラベルをクリア
|
340
|
-
|
341
171
|
foreach(Label label in test) label.Content = "";
|
342
172
|
|
343
|
-
|
344
|
-
|
345
173
|
var firstDate = new DateTime((int)ChangeYEAR.SelectedItem, (int)ChangeMONTH.SelectedItem, 1);
|
346
|
-
|
347
174
|
int lastday = firstDate.AddMonths(1).AddDays(-1).Day;
|
348
|
-
|
349
175
|
int dayOFWeek = (int)firstDate.DayOfWeek;
|
350
176
|
|
351
|
-
|
352
|
-
|
353
177
|
for(int day = 1; day <= lastday; day++)
|
354
|
-
|
355
178
|
{
|
356
|
-
|
357
179
|
int index = day - 1 + dayOFWeek;
|
358
|
-
|
359
180
|
test[index].Content = day;
|
360
|
-
|
361
181
|
}
|
362
|
-
|
363
182
|
}
|
364
183
|
|
365
|
-
|
366
|
-
|
367
184
|
private void Today_Click(object sender, RoutedEventArgs e)
|
368
|
-
|
369
185
|
{
|
370
|
-
|
371
186
|
DateTime now = DateTime.Now;
|
372
187
|
|
373
|
-
|
374
|
-
|
375
188
|
ChangeYEAR.SelectedItem = now.Year;
|
376
|
-
|
377
189
|
ChangeMONTH.SelectedItem = now.Month;
|
378
|
-
|
379
190
|
}
|
380
|
-
|
381
191
|
}
|
382
|
-
|
383
192
|
}
|
384
|
-
|
385
|
-
```
|
193
|
+
```
|
386
|
-
|
387
|
-
|
388
194
|
|
389
195
|
---
|
390
196
|
|
391
|
-
|
392
|
-
|
393
197
|
> オススメないし初心者向けのものがあれば教えてください
|
394
198
|
|
395
|
-
|
396
|
-
|
397
199
|
本の形になっているのはこちらでしょうか(無料で内容を公開されていますが)
|
398
|
-
|
399
200
|
[WPF 4.5入門 | 大田一希 | 工学 | Kindleストア | Amazon](https://www.amazon.co.jp/WPF-4-5%E5%85%A5%E9%96%80-%E5%A4%A7%E7%94%B0%E4%B8%80%E5%B8%8C-ebook/dp/B015WXYUUU)
|
400
201
|
|
401
|
-
|
402
|
-
|
403
202
|
あとはWeb上の情報でしょうか。
|
404
203
|
|
405
|
-
|
406
|
-
|
407
204
|
ある程度まとまっているもの(順不同)
|
408
|
-
|
409
205
|
[ 連載:WPF入門 - @IT](https://www.atmarkit.co.jp/ait/series/2794/)
|
410
|
-
|
411
206
|
[ » WPF 学習用ドキュメント作りました](http://kisuke0303.sakura.ne.jp/blog/?p=340)
|
412
|
-
|
413
207
|
[WPF Prism 入門エントリまとめ | :: halation ghost ::](https://elf-mission.net/wpf-prism-index/) ちょっと難しめ
|
414
208
|
|
415
|
-
|
416
|
-
|
417
209
|
ブログ(順不同)
|
418
|
-
|
419
210
|
[かずきのBlog@hatena](https://blog.okazuki.jp/)
|
420
|
-
|
421
211
|
[grabacr.nét | PaaS (Patchouli as a Shachiku)](http://grabacr.net/)
|
422
|
-
|
423
212
|
[uEN Laboratory](http://s-ueno.github.io/) 記事は少ないがこんなこともできるんだ」と夢が広がる
|
1
UniformGrid
test
CHANGED
@@ -98,135 +98,133 @@
|
|
98
98
|
|
99
99
|
</StackPanel>
|
100
100
|
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
<
|
120
|
-
|
121
|
-
<
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
<
|
138
|
-
|
139
|
-
<
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
<
|
156
|
-
|
157
|
-
<
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
<
|
174
|
-
|
175
|
-
<
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
<
|
192
|
-
|
193
|
-
<
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
<
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
</StackPanel>
|
101
|
+
|
102
|
+
|
103
|
+
<UniformGrid
|
104
|
+
|
105
|
+
Width="300"
|
106
|
+
|
107
|
+
Height="300"
|
108
|
+
|
109
|
+
HorizontalAlignment="Left"
|
110
|
+
|
111
|
+
VerticalAlignment="Top"
|
112
|
+
|
113
|
+
Columns="7">
|
114
|
+
|
115
|
+
|
116
|
+
|
117
|
+
<Label Content="Sun" />
|
118
|
+
|
119
|
+
<Label Content="Mon" />
|
120
|
+
|
121
|
+
<Label Content="Tue" />
|
122
|
+
|
123
|
+
<Label Content="Wed" />
|
124
|
+
|
125
|
+
<Label Content="Thu" />
|
126
|
+
|
127
|
+
<Label Content="Fri" />
|
128
|
+
|
129
|
+
<Label Content="Sat" />
|
130
|
+
|
131
|
+
|
132
|
+
|
133
|
+
<Label x:Name="Su1" />
|
134
|
+
|
135
|
+
<Label x:Name="Mo1" />
|
136
|
+
|
137
|
+
<Label x:Name="Tu1" />
|
138
|
+
|
139
|
+
<Label x:Name="We1" />
|
140
|
+
|
141
|
+
<Label x:Name="Th1" />
|
142
|
+
|
143
|
+
<Label x:Name="Fr1" />
|
144
|
+
|
145
|
+
<Label x:Name="Sa1" />
|
146
|
+
|
147
|
+
|
148
|
+
|
149
|
+
<Label x:Name="Su2" />
|
150
|
+
|
151
|
+
<Label x:Name="Mo2" />
|
152
|
+
|
153
|
+
<Label x:Name="Tu2" />
|
154
|
+
|
155
|
+
<Label x:Name="We2" />
|
156
|
+
|
157
|
+
<Label x:Name="Th2" />
|
158
|
+
|
159
|
+
<Label x:Name="Fr2" />
|
160
|
+
|
161
|
+
<Label x:Name="Sa2" />
|
162
|
+
|
163
|
+
|
164
|
+
|
165
|
+
<Label x:Name="Su3" />
|
166
|
+
|
167
|
+
<Label x:Name="Mo3" />
|
168
|
+
|
169
|
+
<Label x:Name="Tu3" />
|
170
|
+
|
171
|
+
<Label x:Name="We3" />
|
172
|
+
|
173
|
+
<Label x:Name="Th3" />
|
174
|
+
|
175
|
+
<Label x:Name="Fr3" />
|
176
|
+
|
177
|
+
<Label x:Name="Sa3" />
|
178
|
+
|
179
|
+
|
180
|
+
|
181
|
+
<Label x:Name="Su4" />
|
182
|
+
|
183
|
+
<Label x:Name="Mo4" />
|
184
|
+
|
185
|
+
<Label x:Name="Tu4" />
|
186
|
+
|
187
|
+
<Label x:Name="We4" />
|
188
|
+
|
189
|
+
<Label x:Name="Th4" />
|
190
|
+
|
191
|
+
<Label x:Name="Fr4" />
|
192
|
+
|
193
|
+
<Label x:Name="Sa4" />
|
194
|
+
|
195
|
+
|
196
|
+
|
197
|
+
<Label x:Name="Su5" />
|
198
|
+
|
199
|
+
<Label x:Name="Mo5" />
|
200
|
+
|
201
|
+
<Label x:Name="Tu5" />
|
202
|
+
|
203
|
+
<Label x:Name="We5" />
|
204
|
+
|
205
|
+
<Label x:Name="Th5" />
|
206
|
+
|
207
|
+
<Label x:Name="Fr5" />
|
208
|
+
|
209
|
+
<Label x:Name="Sa5" />
|
210
|
+
|
211
|
+
|
212
|
+
|
213
|
+
<Label x:Name="Su6" />
|
214
|
+
|
215
|
+
<Label x:Name="Mo6" />
|
216
|
+
|
217
|
+
<Label x:Name="Tu6" />
|
218
|
+
|
219
|
+
<Label x:Name="We6" />
|
220
|
+
|
221
|
+
<Label x:Name="Th6" />
|
222
|
+
|
223
|
+
<Label x:Name="Fr6" />
|
224
|
+
|
225
|
+
<Label x:Name="Sa6" />
|
226
|
+
|
227
|
+
</UniformGrid>
|
230
228
|
|
231
229
|
</StackPanel>
|
232
230
|
|