@@ -178,12 +178,20 @@ private void ShowFlyout(FlyoutBase flyout)
178178 _currentFlyout . Hide ( ) ;
179179 flyout . ShouldConstrainToRootBounds = false ;
180180 _currentFlyout = flyout ;
181- ( ( Microsoft . UI . Xaml . Controls . Grid ) _window . Content ) . ContextFlyout = flyout ;
181+ var grid = ( ( Microsoft . UI . Xaml . Controls . Grid ) _window . Content ) ;
182+ grid . ContextFlyout = flyout ;
182183 _window . Activate ( ) ;
183184 _window . Show ( ) ;
184185 _window . AppWindow . MoveAndResize ( new Windows . Graphics . RectInt32 ( location . X , location . Y , 0 , 0 ) , Microsoft . UI . Windowing . DisplayArea . GetFromPoint ( new Windows . Graphics . PointInt32 ( 0 , 0 ) , Microsoft . UI . Windowing . DisplayAreaFallback . Primary ) ) ;
185186 WindowExtensions . SetForegroundWindow ( _window ) ;
186- _currentFlyout . ShowAt ( _root , new FlyoutShowOptions ( ) { Position = new Windows . Foundation . Point ( 0 , 0 ) } ) ;
187+ double w = ( location . Width - location . X ) / grid . XamlRoot . RasterizationScale ;
188+ double h = ( location . Height - location . Y ) / grid . XamlRoot . RasterizationScale ;
189+
190+ _currentFlyout . ShowAt ( _root , new FlyoutShowOptions ( )
191+ {
192+ Position = new Windows . Foundation . Point ( 0 , 0 ) ,
193+ ExclusionRect = new Windows . Foundation . Rect ( 0 , 0 , w , h )
194+ } ) ;
187195 _currentFlyout . Closing += CurrentFlyout_Closing ;
188196 }
189197 }
@@ -419,7 +427,7 @@ private void ProcessTrayIconEvents(Message message)
419427 return ;
420428 var type = ( WindowsMessages ) ( message . LParam & 0xffff ) ;
421429 var lparam = message . LParam & 0xffff0000 ;
422- System . Diagnostics . Debug . WriteLine ( $ "Tray { type } : LParam=0x{ lparam . ToString ( "x" ) } WParam=0x{ message . WParam . ToString ( "x" ) } ") ;
430+ // System.Diagnostics.Debug.WriteLine($"Tray {type}: LParam=0x{lparam.ToString("x")} WParam=0x{message.WParam.ToString("x")}");
423431
424432 TrayIconEventArgs ? args = null ;
425433 switch ( type )
0 commit comments