Skip to content

Commit c223bc5

Browse files
committed
Making code simpler
1 parent 3f5df94 commit c223bc5

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

Fluent.Ribbon/Controls/ComboBox.cs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -658,11 +658,11 @@ protected override void OnDropDownOpened(EventArgs e)
658658

659659
if (this.SelectedItem is not null)
660660
{
661-
var selectedItemContainer = this.ItemContainerGenerator.ContainerOrContainerContentFromItem<IInputElement>(this.SelectedItem);
662-
if (selectedItemContainer is not null)
663-
{
664-
Keyboard.Focus(selectedItemContainer);
665-
}
661+
var selectedItemContainer = this.ItemContainerGenerator.ContainerOrContainerContentFromItem<IInputElement>(this.SelectedItem);
662+
if (selectedItemContainer is not null)
663+
{
664+
Keyboard.Focus(selectedItemContainer);
665+
}
666666
}
667667

668668
this.focusedElement = Keyboard.FocusedElement;
@@ -678,8 +678,6 @@ protected override void OnDropDownOpened(EventArgs e)
678678
this.scrollViewer.Height = double.NaN;
679679
}
680680

681-
var popupChild = this.DropDownPopup?.Child as FrameworkElement;
682-
683681
var initialHeight = Math.Min(RibbonControl.GetControlWorkArea(this).Height * 2 / 3, this.MaxDropDownHeight);
684682

685683
if (double.IsNaN(this.DropDownHeight) == false)
@@ -693,7 +691,7 @@ protected override void OnDropDownOpened(EventArgs e)
693691
this.scrollViewer.Height = initialHeight;
694692
}
695693

696-
popupChild?.UpdateLayout();
694+
this.DropDownPopup?.Child?.UpdateLayout();
697695
}
698696

699697
/// <inheritdoc />

0 commit comments

Comments
 (0)