protected override void Invoke(object parameter) { if (Target != null) { if (DetailsPopup.AssociatedUIElement == _associatedElement) { return; } DetailsPopup.AssociatedUIElement = _associatedElement; if (PopupDataContext != null) { Target.DataContext = PopupDataContext; } //get the center y coordinate of the list item GeneralTransform gt = _associatedElement.TransformToVisual(Application.Current.RootVisual); Point topLeft = gt.Transform(new Point(0, 0)); double centerY = topLeft.Y + _associatedElement.ActualHeight / 2; double xOffset = GetXOffset(_currentMousePos); DetailsPopup.Show(Target, new Point(_currentMousePos.X, centerY), (int)xOffset, PopupContentContainerStyle, PopupLeaderStyle); } }
/// <summary> /// Hides the popup /// </summary> public void ClosePopup() { DetailsPopup.Close(); }