@@ -24,8 +24,6 @@ public partial class MultiSelectGeneric<TValue>
2424 . AddClass ( "is-fixed-toolbar" , ShowToolbar )
2525 . Build ( ) ;
2626
27- private string ? EditSubmitKeyString => EditSubmitKey == EditSubmitKey . Space ? EditSubmitKey . ToDescriptionString ( ) : null ;
28-
2927 private string ? ToggleClassString => CssBuilder . Default ( "dropdown-toggle scroll" )
3028 . AddClass ( $ "border-{ Color . ToDescriptionString ( ) } ", Color != Color . None && ! IsDisabled )
3129 . AddClass ( "is-fixed" , IsFixedHeight )
@@ -197,7 +195,9 @@ public partial class MultiSelectGeneric<TValue>
197195
198196 private string ? PlaceholderString => SelectedItems . Count == 0 ? PlaceHolder : null ;
199197
200- private string ? ScrollIntoViewBehaviorString => ScrollIntoViewBehavior == ScrollIntoViewBehavior . Smooth ? null : ScrollIntoViewBehavior . ToDescriptionString ( ) ;
198+ private string ? ScrollIntoViewBehaviorString => ScrollIntoViewBehavior == ScrollIntoViewBehavior . Smooth
199+ ? null
200+ : ScrollIntoViewBehavior . ToDescriptionString ( ) ;
201201
202202 [ NotNull ]
203203 private Virtualize < SelectedItem < TValue > > ? _virtualizeElement = default ;
@@ -224,6 +224,11 @@ protected override void OnParametersSet()
224224 ResetRules ( ) ;
225225
226226 _itemsCache = null ;
227+
228+ if ( IsVirtualize == false )
229+ {
230+ ResetSelectedItems ( ) ;
231+ }
227232 }
228233
229234 /// <summary>
@@ -514,4 +519,20 @@ protected override void OnValidate(bool? valid)
514519 Color = valid . Value ? Color . Success : Color . Danger ;
515520 }
516521 }
522+
523+ private void ResetSelectedItems ( )
524+ {
525+ SelectedItems . Clear ( ) ;
526+ if ( Value != null )
527+ {
528+ foreach ( var v in Value )
529+ {
530+ var item = Rows . Find ( i => Equals ( i . Value , v ) ) ;
531+ if ( item != null )
532+ {
533+ SelectedItems . Add ( item ) ;
534+ }
535+ }
536+ }
537+ }
517538}
0 commit comments