1 | using System;
|
---|
2 | using System.Collections.Generic;
|
---|
3 | using System.Linq;
|
---|
4 | using System.Text;
|
---|
5 | using System.Windows;
|
---|
6 | using System.Windows.Controls;
|
---|
7 | using Microsoft.Research.DynamicDataDisplay.Common;
|
---|
8 |
|
---|
9 | namespace Microsoft.Research.DynamicDataDisplay.Charts.Navigation
|
---|
10 | {
|
---|
11 | [Obsolete("Working wrongly.", true)]
|
---|
12 | public sealed class VerticalScrollBar : PlotterScrollBar
|
---|
13 | {
|
---|
14 | /// <summary>
|
---|
15 | /// Initializes a new instance of the <see cref="VerticalScrollBar"/> class.
|
---|
16 | /// </summary>
|
---|
17 | public VerticalScrollBar()
|
---|
18 | {
|
---|
19 | ScrollBar.Orientation = Orientation.Vertical;
|
---|
20 | }
|
---|
21 |
|
---|
22 | private Range<double> GetRange(Rect domain)
|
---|
23 | {
|
---|
24 | return new Range<double>(domain.Top, domain.Bottom);
|
---|
25 | }
|
---|
26 |
|
---|
27 | protected override DataRect CreateVisibleRect(DataRect rect, double scrollValue)
|
---|
28 | {
|
---|
29 | rect.YMin = scrollValue;
|
---|
30 | return rect;
|
---|
31 | }
|
---|
32 |
|
---|
33 | protected override Panel GetHostPanel(Plotter plotter)
|
---|
34 | {
|
---|
35 | return plotter.LeftPanel;
|
---|
36 | }
|
---|
37 |
|
---|
38 | protected override void UpdateScrollBar(Viewport2D viewport)
|
---|
39 | {
|
---|
40 | if (viewport != null && !viewport.Domain.IsEmpty)
|
---|
41 | {
|
---|
42 | if (ScrollBar.Track != null)
|
---|
43 | {
|
---|
44 | //ScrollBar.Track.IsDirectionReversed = true;
|
---|
45 | }
|
---|
46 |
|
---|
47 | visibleRange = new Range<double>(viewport.Visible.YMin, viewport.Visible.YMax);
|
---|
48 | domainRange = new Range<double>(viewport.Domain.YMin, viewport.Domain.YMax);
|
---|
49 |
|
---|
50 | double size = visibleRange.Max - visibleRange.Min;
|
---|
51 | ScrollBar.ViewportSize = size;
|
---|
52 |
|
---|
53 | ScrollBar.Minimum = domainRange.Min + size;
|
---|
54 | ScrollBar.Maximum = domainRange.Max;
|
---|
55 |
|
---|
56 | ScrollBar.Value = visibleRange.Min;
|
---|
57 | ScrollBar.Visibility = Visibility.Visible;
|
---|
58 | }
|
---|
59 | else
|
---|
60 | {
|
---|
61 | ScrollBar.Visibility = Visibility.Collapsed;
|
---|
62 | }
|
---|
63 | }
|
---|
64 |
|
---|
65 | private Range<double> visibleRange;
|
---|
66 | private Range<double> domainRange;
|
---|
67 | }
|
---|
68 | }
|
---|