private void NotifyDataViewMouseEnter(DetailedDataGroupView dataView) { var counterPart = DetailedDataView.GetCounterpart(dataView); Panel.SetZIndex(dataView, 1); if (counterPart != null) { Panel.SetZIndex(counterPart, 0); } dataView.MinimumPriority = (int)DetailedDataViewModel.DisplayPriority.DefaultHidden; dataView.Height = double.NaN; }
private static DetailedDataGroupView GetCounterpart(DetailedDataGroupView target) { var panel = VisualTreeHelper.GetParent(target) as Panel; foreach (UIElement child in panel.Children) { if (child != target) { return((DetailedDataGroupView)child); } } return(null); }
private void NotifyDataViewMouseLeave(DetailedDataGroupView dataView) { var counterPart = DetailedDataView.GetCounterpart(dataView); dataView.MinimumPriority = _defaultDataPriority; var binding = new Binding("ActualHeight"); binding.Converter = SHalfConverter; binding.Source = VisualTreeHelper.GetParent(dataView); dataView.SetBinding(MinHeightProperty, binding); dataView.SetBinding(HeightProperty, binding); }
private void BrightenDataView(DetailedDataGroupView dataView) { dataView.ViewModel.IsDarken = false; }
private void DarkenDataView(DetailedDataGroupView dataView) { dataView.ViewModel.IsDarken = true; }
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); } } } }