Skip to content

Commit

Permalink
Merge pull request #2457 from unoplatform/dev/mara/ir-selection-info
Browse files Browse the repository at this point in the history
  • Loading branch information
kazo0 authored Aug 5, 2024
2 parents 1d33cba + 119b71b commit bc1e4d2
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,19 @@ await TestHelper.WaitFor(async ct =>
}, CT);
}

[TestMethod]
public async Task When_PreselectedItem_SelectedItems_ListView()
{
var (vm, lv, items) = await SetupListView(ListViewSelectionMode.Multiple);

items[0].IsSelected = true;

await TestHelper.WaitFor(async ct =>
{
return (await vm.Items.GetSelectedItems(ct)).SequenceEqual(new MyItem[] { });
}, CT);
}

[TestMethod]
[InjectedPointer(PointerDeviceType.Mouse)]
#if !__SKIA__
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,19 @@ internal class SelectionFacet : IDisposable, ISelectionInfo

private bool _isInit;

public SelectionFacet(IBindableCollectionViewSource source, CollectionChangedFacet collectionChangedFacet, Func < IObservableVector<object>> target)
public SelectionFacet(IBindableCollectionViewSource source, CollectionChangedFacet collectionChangedFacet, Func <IObservableVector<object>> target)
{
_service = source.GetService(typeof(ISelectionService)) as ISelectionService;
_target = new Lazy<IObservableVector<object>>(target, LazyThreadSafetyMode.None);
_dispatcher = source.Dispatcher;
_collectionChangedFacet = collectionChangedFacet;

#if __WINDOWS__
if (_service is not null)
{
UpdateLocalSelection(_service.GetSelectedRanges());
}
#endif
}

private void Init()
Expand Down

0 comments on commit bc1e4d2

Please sign in to comment.