@@ -11,8 +11,8 @@ public abstract partial class PopupAutocomplete : AutocompleteBase
11
11
private bool _closed ;
12
12
private Scheme _scheme ;
13
13
private View _hostControl ;
14
- private View _top ; // The _hostControl's SuperView
15
- private View _popup ;
14
+ private View _top ; // The _hostControl's SuperView
15
+ internal View _popup ;
16
16
private int _toRenderLength ;
17
17
18
18
/// <summary>Creates a new instance of the <see cref="PopupAutocomplete"/> class.</summary>
@@ -70,6 +70,7 @@ public override View HostControl
70
70
{
71
71
_top . Initialized += _top_Initialized ;
72
72
}
73
+
73
74
_top . Removed += _top_Removed ;
74
75
}
75
76
}
@@ -268,7 +269,11 @@ public override void RenderOverlay (Point renderAt)
268
269
else if ( ! Visible || HostControl ? . HasFocus == false || Suggestions . Count == 0 )
269
270
{
270
271
LastPopupPos = null ;
271
- Visible = false ;
272
+
273
+ if ( Visible )
274
+ {
275
+ Close ( ) ;
276
+ }
272
277
273
278
if ( Suggestions . Count == 0 )
274
279
{
@@ -372,16 +377,16 @@ public override void RenderOverlay (Point renderAt)
372
377
if ( PopupInsideContainer )
373
378
{
374
379
_popup . Frame = new (
375
- new ( HostControl . Frame . X + renderAt . X , HostControl . Frame . Y + renderAt . Y ) ,
376
- new ( width , height )
377
- ) ;
380
+ new ( HostControl . Frame . X + renderAt . X , HostControl . Frame . Y + renderAt . Y ) ,
381
+ new ( width , height )
382
+ ) ;
378
383
}
379
384
else
380
385
{
381
386
_popup . Frame = new (
382
- renderAt with { X = HostControl . Frame . X + renderAt . X } ,
383
- new ( width , height )
384
- ) ;
387
+ renderAt with { X = HostControl . Frame . X + renderAt . X } ,
388
+ new ( width , height )
389
+ ) ;
385
390
}
386
391
387
392
_popup . Move ( 0 , 0 ) ;
@@ -419,6 +424,7 @@ protected void Close ()
419
424
ClearSuggestions ( ) ;
420
425
Visible = false ;
421
426
_closed = true ;
427
+
422
428
//RemovePopupFromTop ();
423
429
_popup . Visible = false ;
424
430
HostControl ? . SetNeedsDraw ( ) ;
@@ -561,7 +567,6 @@ private void RemovePopupFromTop ()
561
567
_top ? . Remove ( _popup ) ;
562
568
_popup . Dispose ( ) ;
563
569
_popup = null ;
564
-
565
570
}
566
571
}
567
572
@@ -571,6 +576,7 @@ private void _top_Initialized (object sender, EventArgs e)
571
576
{
572
577
_top = sender as View ;
573
578
}
579
+
574
580
AddPopupToTop ( ) ;
575
581
}
576
582
0 commit comments