-
Notifications
You must be signed in to change notification settings - Fork 59
Description
Current behavior
// Explicit selection states to bridge UI selection (ListView SelectedItem/SelectedItems)
public IState<string> SelectedName => State<string>.Empty(this).ForEach(async (item, ct) =>
{
this.Log().LogInformation("SelectedName did change to {item}", item);
});
public IState<IImmutableList<string>> SelectedNames2 => State<IImmutableList<string>>.Empty(this).ForEach(async (items, ct) =>
{
this.Log().LogInformation("SelectedNames did change to '{item}'", items);
});
// List states with selection bridging
public IListState<string> Names => ListState.Value(this, () => _names).Selection(SelectedName);
public IListState<string> Names2 => ListState.Value(this, () => _names).Selection(SelectedNames2);
public async ValueTask SelectMultipleFalse(CancellationToken ct)
{
await Names2.ClearSelectionAsync(ct);
}
public async ValueTask SelectMultipleTrue(CancellationToken ct)
{
var items = await Names2.Where(item => item == "NameOne" || item == "NameThree");
bool selected = await Names2.TrySelectAsync(items, ct);
} <ListView x:Name="MultiSelectList"
ItemsSource="{Binding Names2, Mode=OneWay}"
Grid.Row="3"
IsItemClickEnabled="True"
IsMultiSelectCheckBoxEnabled="True"
SelectionMode="Multiple" />
<StackPanel Grid.Row="0" Grid.Column="1"
HorizontalAlignment="Center" Spacing="10">
<Button Content="Select multiple false"
Command="{Binding SelectMultipleFalse}" />
<Button Content="Select multiple true"
Command="{Binding SelectMultipleTrue}" />
</StackPanel>somehow when selecting the list overload produces two calls?:
info: ListViewTest.Presentation.MainModel[0]
SelectedNames did change to 'NameOne, NameThree'
info: ListViewTest.Presentation.MainModel[0]
SelectedNames did change to 'NameOne'
calling then clear Selection works fine, just also not showing in the UI:
info: ListViewTest.Presentation.MainModel[0]
SelectedNames did change to '(null)'
The ListView with multi selection enabled does not show any of the Selection changes
Expected behavior
Showing selection done from Model in the UI layer would be awesome!
How to reproduce it (as minimally and precisely as possible)
ListViewTest.zip
choose Desktop target for example and try to use the right two buttons to select or unselect the lower ListView items.
Environment
Nuget Package (s): Uno Sdk 6.4.24
Package Version(s):
Affected platform(s):
- iOS
- macOS (AppKit)
- Mac Catalyst
- Android
- WebAssembly
- Windows
- Desktop (not tested on other platforms)
- Build tasks
Visual Studio:
- 2019 (version: )
- 2022 (version: )
- 2026 (version: 18.0.0)
- Visual Studio Code (version: )
- Rider Windows (version: )
- Rider macOS (version: )
Relevant plugins:
- Resharper (version: )
Anything else we need to know?
initially issued on discord by @JazSqared https://discord.com/channels/1182775715242967050/1375122949576724500/1439282967410380850
On Android this app does even show a even stranger behaviour, no idea how that should be named... maybe haluzinating pages?
captured app startup on android emulator Pixel on video, but its too large for github, so uploaded on OneDrive:
https://technischekonstruktion-my.sharepoint.com/:v:/g/personal/info_technische-konstruktion_com/IQCBvE_w3RpmRYcZVuLftvr1AQ826SG54aag9z3drx9GqTM?e=CmXYEw