Example #1
0
 private void _dataViewUpdateTimer_Tick(object sender, EventArgs e)
 {
     if (!DetailedDataView.IsMouseOverElement(this) && this.DataContext != null)
     {
         this.UpdateDataViewsMouseOverState();
     }
 }
Example #2
0
        private void UpdateDataViewsMouseOverState()
        {
            // mouse might be over 2 data views at the same time (e.g. an expanded upper view and a covered lower view)
            var mouseOverDataViews = new List <DetailedDataGroupView>(2);

            if (!Keyboard.IsKeyDown(Key.LeftCtrl) && this.IsMouseOver)
            {
                foreach (var dataView in _dataViews)
                {
                    if (DetailedDataView.IsMouseOverElement(dataView))
                    {
                        mouseOverDataViews.Add(dataView);

                        if (mouseOverDataViews.Count == 2)
                        {
                            break;
                        }
                    }
                }
            }

            if (mouseOverDataViews.Count == 0)
            {
                if (_previousMouseOverDataView != null)
                {
                    this.NotifyDataViewMouseLeave(_previousMouseOverDataView);
                }

                _previousMouseOverDataView = null;

                foreach (var dataView in _dataViews)
                {
                    this.BrightenDataView(dataView);
                }
            }
            else
            {
                var mouseOverDataView = mouseOverDataViews.OrderByDescending(v => Panel.GetZIndex(v)).First();

                if (_previousMouseOverDataView == mouseOverDataView)
                {
                    return;
                }

                if (_previousMouseOverDataView != null)
                {
                    this.NotifyDataViewMouseLeave(_previousMouseOverDataView);
                }

                this.NotifyDataViewMouseEnter(mouseOverDataView);
                _previousMouseOverDataView = mouseOverDataView;


                foreach (var dataView in _dataViews)
                {
                    if (dataView == mouseOverDataView)
                    {
                        this.BrightenDataView(dataView);
                    }
                    else
                    {
                        this.DarkenDataView(dataView);
                    }
                }
            }
        }