Skip to content

Commit 2af7022

Browse files
committed
Update ComboBoxHelper.cs
1 parent b3fe77d commit 2af7022

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

source/iNKORE.UI.WPF.Modern/Controls/Helpers/ComboBoxHelper.cs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -117,13 +117,10 @@ private static void UpdateCornerRadius(ComboBox comboBox, bool isDropDownOpen)
117117
bool isOpenDown = GetPopupVerticalOffset(comboBox) > popup.VerticalOffset;
118118

119119
if (isOpenDown &&
120-
comboBox.ItemContainerGenerator.ContainerFromItem(comboBox.SelectedItem) is FrameworkElement itemContainer)
120+
comboBox.ItemContainerGenerator.ContainerFromItem(comboBox.SelectedItem) is FrameworkElement itemContainer &&
121+
itemContainer.TranslatePoint(new Point(0, -itemContainer.ActualHeight + comboBox.Margin.Top + comboBox.Padding.Top), comboBox) is { Y: not 0 } itemTop)
121122
{
122-
var itemTop = itemContainer.TranslatePoint(new Point(0, -itemContainer.ActualHeight + comboBox.Margin.Top + comboBox.Padding.Top), comboBox);
123-
if (itemTop.Y != 0)
124-
{
125-
popup.VerticalOffset -= itemTop.Y;
126-
}
123+
popup.VerticalOffset -= itemTop.Y;
127124
}
128125

129126
if (popup.VerticalOffset is 0)

0 commit comments

Comments
 (0)