質問編集履歴
1
現時点でのコードを記載。
test
CHANGED
File without changes
|
test
CHANGED
@@ -243,3 +243,249 @@
|
|
243
243
|
参考にできるサイトでも構いませんので、皆さんの力をお借り出来ればと思います。
|
244
244
|
|
245
245
|
どうぞよろしくお願いいたします。
|
246
|
+
|
247
|
+
|
248
|
+
|
249
|
+
### 現在のソースコード
|
250
|
+
|
251
|
+
```xaml
|
252
|
+
|
253
|
+
<Window x:Class="WpfApplication1.MainWindow"
|
254
|
+
|
255
|
+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
256
|
+
|
257
|
+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
258
|
+
|
259
|
+
Title="MainWindow" Height="300" Width="525">
|
260
|
+
|
261
|
+
<Grid>
|
262
|
+
|
263
|
+
<Grid.ColumnDefinitions>
|
264
|
+
|
265
|
+
<ColumnDefinition/>
|
266
|
+
|
267
|
+
<ColumnDefinition/>
|
268
|
+
|
269
|
+
</Grid.ColumnDefinitions>
|
270
|
+
|
271
|
+
<!--右のスクロールを動かす→左のスクロールが同期する、という動作は未実装です。-->
|
272
|
+
|
273
|
+
<!--現在、仮にMouseUpイベントを拾っていますが、これでよいのでしょうか?-->
|
274
|
+
|
275
|
+
<!--ほぼほぼ想定通りの動きをするのですが、どれかItemsをクリックしないと反応してくれないのが心残り…-->
|
276
|
+
|
277
|
+
<ListView Name="LeftListView" Grid.Column="0" MouseUp="LeftListView_MouseUp">
|
278
|
+
|
279
|
+
<ListView.Items>
|
280
|
+
|
281
|
+
<TextBlock Text="a"/>
|
282
|
+
|
283
|
+
<TextBlock Text="b"/>
|
284
|
+
|
285
|
+
<TextBlock Text="c"/>
|
286
|
+
|
287
|
+
<TextBlock Text="d"/>
|
288
|
+
|
289
|
+
<TextBlock Text="e"/>
|
290
|
+
|
291
|
+
<TextBlock Text="f"/>
|
292
|
+
|
293
|
+
<TextBlock Text="g"/>
|
294
|
+
|
295
|
+
<TextBlock Text="h"/>
|
296
|
+
|
297
|
+
<TextBlock Text="i"/>
|
298
|
+
|
299
|
+
<TextBlock Text="j"/>
|
300
|
+
|
301
|
+
<TextBlock Text="k"/>
|
302
|
+
|
303
|
+
<TextBlock Text="l"/>
|
304
|
+
|
305
|
+
<TextBlock Text="m"/>
|
306
|
+
|
307
|
+
<TextBlock Text="n"/>
|
308
|
+
|
309
|
+
<TextBlock Text="o"/>
|
310
|
+
|
311
|
+
<TextBlock Text="p"/>
|
312
|
+
|
313
|
+
<TextBlock Text="q"/>
|
314
|
+
|
315
|
+
<TextBlock Text="r"/>
|
316
|
+
|
317
|
+
<TextBlock Text="s"/>
|
318
|
+
|
319
|
+
<TextBlock Text="t"/>
|
320
|
+
|
321
|
+
<TextBlock Text="u"/>
|
322
|
+
|
323
|
+
<TextBlock Text="v"/>
|
324
|
+
|
325
|
+
<TextBlock Text="w"/>
|
326
|
+
|
327
|
+
<TextBlock Text="x"/>
|
328
|
+
|
329
|
+
<TextBlock Text="y"/>
|
330
|
+
|
331
|
+
<TextBlock Text="z"/>
|
332
|
+
|
333
|
+
</ListView.Items>
|
334
|
+
|
335
|
+
</ListView>
|
336
|
+
|
337
|
+
<ListView Name="RightListView" Grid.Column="1">
|
338
|
+
|
339
|
+
<ListView.Items>
|
340
|
+
|
341
|
+
<TextBlock Text="a"/>
|
342
|
+
|
343
|
+
<TextBlock Text="b"/>
|
344
|
+
|
345
|
+
<TextBlock Text="c"/>
|
346
|
+
|
347
|
+
<TextBlock Text="d"/>
|
348
|
+
|
349
|
+
<TextBlock Text="e"/>
|
350
|
+
|
351
|
+
<TextBlock Text="f"/>
|
352
|
+
|
353
|
+
<TextBlock Text="g"/>
|
354
|
+
|
355
|
+
<TextBlock Text="h"/>
|
356
|
+
|
357
|
+
<TextBlock Text="i"/>
|
358
|
+
|
359
|
+
<TextBlock Text="j"/>
|
360
|
+
|
361
|
+
<TextBlock Text="k"/>
|
362
|
+
|
363
|
+
<TextBlock Text="l"/>
|
364
|
+
|
365
|
+
<TextBlock Text="m"/>
|
366
|
+
|
367
|
+
<TextBlock Text="n"/>
|
368
|
+
|
369
|
+
<TextBlock Text="o"/>
|
370
|
+
|
371
|
+
<TextBlock Text="p"/>
|
372
|
+
|
373
|
+
<TextBlock Text="q"/>
|
374
|
+
|
375
|
+
<TextBlock Text="r"/>
|
376
|
+
|
377
|
+
<TextBlock Text="s"/>
|
378
|
+
|
379
|
+
<TextBlock Text="t"/>
|
380
|
+
|
381
|
+
<TextBlock Text="u"/>
|
382
|
+
|
383
|
+
<TextBlock Text="v"/>
|
384
|
+
|
385
|
+
<TextBlock Text="w"/>
|
386
|
+
|
387
|
+
<TextBlock Text="x"/>
|
388
|
+
|
389
|
+
<TextBlock Text="y"/>
|
390
|
+
|
391
|
+
<TextBlock Text="z"/>
|
392
|
+
|
393
|
+
</ListView.Items>
|
394
|
+
|
395
|
+
</ListView>
|
396
|
+
|
397
|
+
</Grid>
|
398
|
+
|
399
|
+
</Window>
|
400
|
+
|
401
|
+
```
|
402
|
+
|
403
|
+
|
404
|
+
|
405
|
+
```C#
|
406
|
+
|
407
|
+
// MainWindow.xaml.cs
|
408
|
+
|
409
|
+
using System;
|
410
|
+
|
411
|
+
using System.Collections.Generic;
|
412
|
+
|
413
|
+
using System.Linq;
|
414
|
+
|
415
|
+
using System.Windows;
|
416
|
+
|
417
|
+
using System.Windows.Automation;
|
418
|
+
|
419
|
+
using System.Windows.Automation.Peers;
|
420
|
+
|
421
|
+
using System.Windows.Automation.Provider;
|
422
|
+
|
423
|
+
using System.Windows.Controls;
|
424
|
+
|
425
|
+
using System.Windows.Media;
|
426
|
+
|
427
|
+
|
428
|
+
|
429
|
+
namespace WpfApplication1
|
430
|
+
|
431
|
+
{
|
432
|
+
|
433
|
+
/// <summary>
|
434
|
+
|
435
|
+
/// MainWindow.xaml の相互作用ロジック
|
436
|
+
|
437
|
+
/// </summary>
|
438
|
+
|
439
|
+
public partial class MainWindow : Window
|
440
|
+
|
441
|
+
{
|
442
|
+
|
443
|
+
public MainWindow()
|
444
|
+
|
445
|
+
{
|
446
|
+
|
447
|
+
InitializeComponent();
|
448
|
+
|
449
|
+
}
|
450
|
+
|
451
|
+
|
452
|
+
|
453
|
+
private void LeftListView_MouseUp(object sender, System.Windows.Input.MouseButtonEventArgs e)
|
454
|
+
|
455
|
+
{
|
456
|
+
|
457
|
+
var left = LeftListView;
|
458
|
+
|
459
|
+
var scroll = left.Descendants<ScrollViewer>().FirstOrDefault();
|
460
|
+
|
461
|
+
|
462
|
+
|
463
|
+
scroll.ScrollChanged += scroll_ScrollChanged;
|
464
|
+
|
465
|
+
}
|
466
|
+
|
467
|
+
|
468
|
+
|
469
|
+
private void scroll_ScrollChanged(object sender, ScrollChangedEventArgs e)
|
470
|
+
|
471
|
+
{
|
472
|
+
|
473
|
+
var right = RightListView;
|
474
|
+
|
475
|
+
var scroll = right.Descendants<ScrollViewer>().FirstOrDefault();
|
476
|
+
|
477
|
+
|
478
|
+
|
479
|
+
double scrollValue = e.VerticalOffset;
|
480
|
+
|
481
|
+
scroll.ScrollToVerticalOffset(scrollValue);
|
482
|
+
|
483
|
+
}
|
484
|
+
|
485
|
+
}
|
486
|
+
|
487
|
+
}
|
488
|
+
|
489
|
+
|
490
|
+
|
491
|
+
```
|