Пример #1
0
        public MainWindow()
        {
            InitializeComponent();


            grid = Graph;// new VirtualCanvas();
            grid.SmallScrollIncrement = new Size(_tileWidth + _tileMargin, _tileHeight + _tileMargin);

            //Scroller.Content = grid;
            object v = Scroller.GetValue(ScrollViewer.CanContentScrollProperty);

            Canvas target = grid.ContentCanvas;

            zoom     = new MapZoom(target);
            pan      = new Pan(target, zoom);
            rectZoom = new RectangleSelectionGesture(target, zoom, ModifierKeys.Control);
            rectZoom.ZoomSelection = true;
            autoScroll             = new AutoScroll(target, zoom);
            zoom.ZoomChanged      += new EventHandler(OnZoomChanged);

            grid.VisualsChanged     += new EventHandler <VisualChangeEventArgs>(OnVisualsChanged);
            ZoomSlider.ValueChanged += new RoutedPropertyChangedEventHandler <double>(OnZoomSliderValueChanged);

            grid.Scale.Changed     += new EventHandler(OnScaleChanged);
            grid.Translate.Changed += new EventHandler(OnScaleChanged);

            grid.Background = new SolidColorBrush(Color.FromRgb(0xd0, 0xd0, 0xd0));
            grid.ContentCanvas.Background = Brushes.White;

            AllocateNodes();
        }