Exemple #1
0
        private GraphViewModel graphViewModel; // the viewmodel class

        /// <summary>
        /// Initializes the GraphView and draws the existing dots
        /// </summary>
        public GraphView()
        {
            InitializeComponent();

            graphViewModel = StaticValues.graphViewModel;
            graphViewModel.SwitchToThisView();

            this.BindingContext = graphViewModel;

            this.SizeChanged                   += graphViewModel.UpdateUiElement; // when the window size is changed, move the dots/values to their correct locations
            SliderZoom.ValueChanged            += KeepScrollPosistion;
            AcceptedLineValueEntry.TextChanged += graphViewModel.UpdateAcceptedValueLine;
            graphViewModel.GetGraphDotsList().CollectionChanged += DrawChangedDots; // Called when a new dot/value is added to the graph list
            StaticValues.graphYValues.CollectionChanged += DrawYValueListChanged;
            GraphScroller.Scrolled += GraphYValuesFollowScroll;

            DrawExistingDots();
            DrawExistingYValues();
        }