Example #1
0
        private void UpdateDataPointTemplates(XBarChartView instance)
        {
            if (instance.XBarChart.ActualHeight > 1 && instance.XBarChart.Height >= 1)
            {
                instance.XBarChart.Height -= 1;               
                _restoreBorder = true;
            }

            if (_firstUpdate)
            {
                Observable.FromEventPattern<SizeChangedEventHandler, SizeChangedEventArgs>(
                    handler => instance.XBarChart.SizeChanged += handler,
                    handler => instance.XBarChart.SizeChanged -= handler
                ).SubscribeWeakly(this, (target, handler) =>
                {
                    if (target._restoreBorder)
                    {
                        target.XBarChart.Height += (handler.EventArgs.PreviousSize.Height - handler.EventArgs.NewSize.Height);
                        target._restoreBorder = false;
                    }
                });

                _firstUpdate = false;
            }
        }
Example #2
0
        private void UpdatePoints(XBarChartView instance, EventPattern<PropertyChangedEventArgs> handler)
        {
            if (((ChartBase)DataContext).DataSource.Count > 0)
            {
                if (handler.EventArgs.PropertyName == "USL" || handler.EventArgs.PropertyName == "LSL")
                    UpdateDataPointTemplates(instance);

                if (handler.EventArgs.PropertyName.Contains("Show"))
                    OnPropertyChanged("ShowSpecsCheckbox");
            }
        }
Example #3
0
 private void OnDataContextPropertyChanged(XBarChartView instance, EventPattern<PropertyChangedEventArgs> handler)
 {
     if (handler.EventArgs.PropertyName.Contains("Show"))
         UpdateDataPointTemplates(instance);
 }
Example #4
0
        private void OnAddNativeBehavior(XBarChartView currentControl, EventPattern<EventArgs> eventPattern)
        {
            Dispatcher.BeginInvoke(() =>
            {
                var nativeBehavior = ((TrackballBehavior)eventPattern.Sender);

                Observable.FromEventPattern<EventHandler<TrackBallInfoEventArgs>, TrackBallInfoEventArgs>(
                    handler => nativeBehavior.TrackInfoUpdated += handler,
                    handler => nativeBehavior.TrackInfoUpdated -= handler
                ).SubscribeWeakly(this, (target, handler) => target.ChartTrackBallBehavior_TrackInfoUpdated(handler.Sender, handler.EventArgs));

                try
                {
                    currentControl.XBarChart.Behaviors.Add(nativeBehavior);
                    nativeBehavior.Parents.Add(currentControl.XBarChart);
                }
                catch (InvalidOperationException){}
            });

            _isObsolete = true;
        }