Skip to content

Commit

Permalink
Fix issue with settings button in top mode not receiving pointer even…
Browse files Browse the repository at this point in the history
  • Loading branch information
Kinnara committed May 27, 2020
1 parent 22f15fe commit fa446fe
Showing 1 changed file with 18 additions and 17 deletions.
35 changes: 18 additions & 17 deletions ModernWpf.Controls/NavigationView/NavigationViewItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,26 +88,27 @@ public override void OnApplyTemplate()

}

if (GetTemplateChildT<NavigationViewItemPresenter>(c_navigationViewItemPresenterName, controlProtected) is { } presenter)
UIElement presenter;
{
m_navigationViewItemPresenter = presenter;

presenter.MouseDown += OnPresenterPointerPressed;
presenter.MouseUp += OnPresenterPointerReleased;
presenter.MouseEnter += OnPresenterPointerEntered;
presenter.MouseLeave += OnPresenterPointerCanceled;
presenter.LostMouseCapture += OnPresenterPointerCaptureLost;
}
// WPF
else
{
MouseDown += OnPresenterPointerPressed;
MouseUp += OnPresenterPointerReleased;
MouseEnter += OnPresenterPointerEntered;
MouseLeave += OnPresenterPointerCanceled;
LostMouseCapture += OnPresenterPointerCaptureLost;
presenter = init();
UIElement init()
{
if (GetTemplateChildT<NavigationViewItemPresenter>(c_navigationViewItemPresenterName, controlProtected) is { } presenter)
{
m_navigationViewItemPresenter = presenter;
return presenter;
}
// We don't have a presenter, so we are our own presenter.
return this;
}
}

presenter.MouseDown += OnPresenterPointerPressed;
presenter.MouseUp += OnPresenterPointerReleased;
presenter.MouseEnter += OnPresenterPointerEntered;
presenter.MouseLeave += OnPresenterPointerCanceled;
presenter.LostMouseCapture += OnPresenterPointerCaptureLost;

m_toolTip = GetTemplateChildT<ToolTip>("ToolTip", controlProtected);

if (GetSplitView() is { } splitView)
Expand Down

0 comments on commit fa446fe

Please sign in to comment.