File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -168,9 +168,14 @@ public ListView ()
168
168
}
169
169
170
170
/// <inheritdoc />
171
- protected override void OnFrameChanged ( in Rectangle frame )
171
+ protected override void OnViewportChanged ( DrawEventArgs e )
172
172
{
173
173
SetContentSize ( new Size ( MaxLength , _source ? . Count ?? Viewport . Height ) ) ;
174
+ }
175
+
176
+ /// <inheritdoc />
177
+ protected override void OnFrameChanged ( in Rectangle frame )
178
+ {
174
179
EnsureSelectedItemVisible ( ) ;
175
180
}
176
181
@@ -394,6 +399,10 @@ public bool UnmarkAllButSelected ()
394
399
/// <summary>Ensures the selected item is always visible on the screen.</summary>
395
400
public void EnsureSelectedItemVisible ( )
396
401
{
402
+ if ( _selected == - 1 )
403
+ {
404
+ return ;
405
+ }
397
406
if ( _selected < Viewport . Y )
398
407
{
399
408
Viewport = Viewport with { Y = _selected } ;
You can’t perform that action at this time.
0 commit comments