Skip to content

Commit

Permalink
Fixes #1014 by using dpi scale at the correct place
Browse files Browse the repository at this point in the history
  • Loading branch information
batzen committed Mar 9, 2022
1 parent d59dd36 commit cd97882
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
8 changes: 8 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog for Fluent.Ribbon

## 9.0.4

- ### Bug fixes

- [#1014](../../issues/1014) - Ribbon menu not fully displayed after minimized
- `IconPresenter` must not be focusable
- Fixed mouse over and keyboard focus colors of ComboBox

## 9.0.3

- ### Bug fixes
Expand Down
8 changes: 5 additions & 3 deletions Fluent.Ribbon/Controls/RibbonTabControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -936,16 +936,18 @@ private void OnRibbonTabPopupOpening()
var dpiScaleX = VisualTreeHelper.GetDpi(this).DpiScaleX;
#endif

var inWindowRibbonWidth = monitorInfo.rcWork.Right - Math.Max(monitorInfo.rcWork.Left, tabControlUpperLeftOnScreen.X);
var inWindowRibbonWidth = (monitorInfo.rcWork.Right - Math.Max(monitorInfo.rcWork.Left, tabControlUpperLeftOnScreen.X)) / dpiScaleX;

var actualWidth = this.ActualWidth;

// Constraint when left upper corner is outside the current monitor
if (tabControlUpperLeftOnScreen.X < monitorInfo.rcWork.Left)
{
actualWidth -= (monitorInfo.rcWork.Left - tabControlUpperLeftOnScreen.X) / widthFactor;
actualWidth -= (monitorInfo.rcWork.Left - tabControlUpperLeftOnScreen.X) / dpiScaleX;
}

// Set width and prevent negative values
this.DropDownPopup.Width = Math.Max(0, Math.Min(actualWidth, inWindowRibbonWidth) / dpiScaleX);
this.DropDownPopup.Width = Math.Max(0, Math.Min(actualWidth, inWindowRibbonWidth));
}

return new[]
Expand Down

0 comments on commit cd97882

Please sign in to comment.