File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -69,13 +69,13 @@ protected override Size MeasureOverride(Size availableSize)
69
69
else
70
70
{
71
71
Rect visibleBounds ;
72
- if ( XamlRoot . VisualTree . ContentRoot . Type == ContentRootType . CoreWindow )
72
+ if ( XamlRoot is not { } xamlRoot || xamlRoot . VisualTree . ContentRoot . Type == ContentRootType . CoreWindow )
73
73
{
74
74
visibleBounds = ApplicationView . GetForCurrentView ( ) . VisibleBounds ;
75
75
}
76
76
else
77
77
{
78
- visibleBounds = XamlRoot . Bounds ;
78
+ visibleBounds = xamlRoot . Bounds ;
79
79
}
80
80
visibleBounds . Width = Math . Min ( availableSize . Width , visibleBounds . Width ) ;
81
81
visibleBounds . Height = Math . Min ( availableSize . Height , visibleBounds . Height ) ;
@@ -165,14 +165,15 @@ protected override Size ArrangeOverride(Size finalSize)
165
165
// Defer to the popup owner the responsibility to place the popup (e.g. ComboBox)
166
166
167
167
Rect visibleBounds ;
168
- if ( XamlRoot . VisualTree . ContentRoot . Type = = ContentRootType . CoreWindow )
168
+ if ( XamlRoot is { } xamlRoot && xamlRoot . VisualTree . ContentRoot . Type ! = ContentRootType . CoreWindow )
169
169
{
170
- visibleBounds = ApplicationView . GetForCurrentView ( ) . VisibleBounds ;
170
+ visibleBounds = xamlRoot . Bounds ;
171
171
}
172
172
else
173
173
{
174
- visibleBounds = XamlRoot . Bounds ;
174
+ visibleBounds = ApplicationView . GetForCurrentView ( ) . VisibleBounds ;
175
175
}
176
+
176
177
visibleBounds . Width = Math . Min ( finalSize . Width , visibleBounds . Width ) ;
177
178
visibleBounds . Height = Math . Min ( finalSize . Height , visibleBounds . Height ) ;
178
179
You can’t perform that action at this time.
0 commit comments