Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ListBox is not implemented #1362

Open
1 task done
MelbourneDeveloper opened this issue Aug 11, 2019 · 10 comments
Open
1 task done

ListBox is not implemented #1362

MelbourneDeveloper opened this issue Aug 11, 2019 · 10 comments
Assignees
Labels
area/porting 🖨️ Categorizes an issue or PR as relevant for porting of WinUI code difficulty/medium 🤔 Categorizes an issue for which the difficulty level is reachable with a good understanding of WinUI help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. kind/bug Something isn't working platform/wasm 🌐 Categorizes an issue or PR as relevant to the WebAssembly platform project/items 🧾 Categorizes an issue or PR as relevant to items (ItemsControl, ItemsRepeater, ...)

Comments

@MelbourneDeveloper
Copy link

MelbourneDeveloper commented Aug 11, 2019

Current behavior

When the ItemsSource on a ListBox is set, no items are populated. However, if the browser is maximised or otherwise resized, the items will populate.

Expected behavior

ListBox is populated as soon as ItemsSource is set.

How to reproduce it (as minimally and precisely as possible)

  • Clone this repo: https://github.com/MelbourneDeveloper/RestClient.Net
  • Hard reset to Tag UnoIssue1362
  • Open the samples solution
  • Restore NuGets
  • Run the sample RestClient.Net.Samples.Uno.Wasm
  • Click the 'Get My Repos' button. Notice that the "Loading..." text comes up quickly and disappears but you do not see any items in the ListBox.
  • Resize the browser window
  • Notice items show up in the top ListBox

Environment

Windows 10
Firefox (WASM)

Visual Studio

  • 2017 (version: 15.9.14)

Anything else we need to know?

This has happened in multiple different projects. It also happens in Edge.

@MelbourneDeveloper MelbourneDeveloper added kind/bug Something isn't working triage/untriaged Indicates an issue requires triaging or verification labels Aug 11, 2019
@ghuntley ghuntley added platform/wasm 🌐 Categorizes an issue or PR as relevant to the WebAssembly platform and removed triage/untriaged Indicates an issue requires triaging or verification labels Aug 13, 2019
@ghuntley
Copy link
Member

Confirming that I've been able to reproduce this in master on the samples app. The problem manifests worst on Edge and happens less with Firefox. This is what I see.

ezgif-4-1c3be2418788

Is this similar to what you see?

@MelbourneDeveloper
Copy link
Author

@ghuntley it looks like it's in the ballpark. But in my case, I don't see anything in the listbox until I resize the browser. Very easy to see in the sample I posted.

@MelbourneDeveloper MelbourneDeveloper changed the title ListBox Doesn't Update Layout On ItemSource Set ListBox Doesn't Display Items Aug 15, 2019
@MelbourneDeveloper
Copy link
Author

@ghuntley there is an update on this.

I thought the issue might because I was setting the ItemsSource directly rather than using binding. So, I tried creating a ViewModel, and binding to the ItemsSource. I got the same result.

I thought that perhaps the issue was because UpdateLayout was not being called. So, I manually called UpdateLayout after the items were set. Again, same result.

I also tried manually adding an item in to the ObservableCollection to try to wake up: same result.

I also tried in Chrome. Same result.

The problem is very easy to reproduce if you grab my sample.

@MelbourneDeveloper
Copy link
Author

@ghuntley I switched my sample to a ComboBox so I could get it working. I've tagged the issue UnoIssue1362 so if you grab that commit, you will see the issue.

@carldebilly
Copy link
Member

I tried the original report (with a ListView & tag UnoIssue1362) and I confirm I see the bug. I upgraded Uno.UI to latest stable version:

<!-- RestClient.Net.Samples.Uno.Wasm.csproj -->
<ItemGroup>
  <PackageReference Include="Newtonsoft.Json" Version="12.0.2" />
  <PackageReference Include="Uno.UI" Version="1.45.0" />
  <PackageReference Include="Uno.Wasm.Bootstrap" Version="1.0.0-dev.302" />
  <DotNetCliToolReference Include="Uno.Wasm.Bootstrap.Cli" Version="1.0.0-dev.302" />
</ItemGroup>

Reported problem solved.

But I'm not sure the @ghuntley's problem with SampleApps is related...

@MelbourneDeveloper
Copy link
Author

@carldebilly , @ghuntley thanks for looking in to this. Unfortunately the problem is different with the latest version. The ListBox doesn't show up at all. I made the ListBox red to highlight the issue. You can see it in UWP, but not on Wasm (Firefox, Edge or Chrome).

Wasm (Firefox,Edge,Chrome):
image

UWP:
image

Please see the branch here . This has your NuGet upgrades in it.

@carldebilly
Copy link
Member

Ok I'll reopen this issue.

@davidjohnoliver
Copy link
Contributor

davidjohnoliver commented Oct 31, 2019

Currently the only code for ListBox is the autogenerated stub: https://github.com/unoplatform/uno/blob/master/src/Uno.UI/Generated/3.0.0.0/Windows.UI.Xaml.Controls/ListBox.cs

The control works 'in some fashion' because it inherits the functionality of ItemsControl and Selector. However the ctor will raise an error, there's no default style, etc.

GitHub
Build Mobile, Desktop and WebAssembly apps with C# and XAML. Today. Open source and professionally supported. - unoplatform/uno

To implement this, an authored .cs file should be created with the members required, and the missing style added to https://github.com/unoplatform/uno/blob/master/src/Uno.UI/UI/Xaml/Style/Generic/Generic.xaml, with any adjustments needed (eg, we don't support VirtualizingStackPanel, ItemsStackPanel should probably be used instead).

@carldebilly carldebilly modified the milestones: 3.1, HighPriority Aug 31, 2020
@davidjohnoliver davidjohnoliver removed this from the HighPriority milestone Sep 1, 2020
@agneszitte agneszitte added project/items 🧾 Categorizes an issue or PR as relevant to items (ItemsControl, ItemsRepeater, ...) and removed priority/important-longterm labels Sep 21, 2020
@jeromelaban
Copy link
Member

Comment from @michael-hawker on Discord, about the ease of use of ListBox when compared to ListView:

ListViewItem just encapsulates everything in the ListViewItemPresenter and if you use the expanded template it has a bunch of Borders and Rectangles and other behavior which are harder to style around. ListBox on the other hand is pretty bare-bones and is an easy starting point. Justin Liu gave this feedback to the platform team a while back too.

@michael-hawker
Copy link

FYI @JustinXinLiu can probably elaborate a bit more of the specifics better than I can. 🙂

@davidjohnoliver davidjohnoliver changed the title ListBox Doesn't Display Items ListBox is not implemented Dec 17, 2020
@jeromelaban jeromelaban added the difficulty/tbd Categorizes an issue for which the difficulty level needs to be defined. label Feb 15, 2021
@davidjohnoliver davidjohnoliver removed the difficulty/tbd Categorizes an issue for which the difficulty level needs to be defined. label Mar 1, 2021
@davidjohnoliver davidjohnoliver added difficulty/medium 🤔 Categorizes an issue for which the difficulty level is reachable with a good understanding of WinUI help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. labels Mar 1, 2021
@MartinZikmund MartinZikmund changed the title ListBox is not implemented ListBox is not implemented May 31, 2023
@MartinZikmund MartinZikmund self-assigned this May 31, 2023
@MartinZikmund MartinZikmund added the area/porting 🖨️ Categorizes an issue or PR as relevant for porting of WinUI code label Jun 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/porting 🖨️ Categorizes an issue or PR as relevant for porting of WinUI code difficulty/medium 🤔 Categorizes an issue for which the difficulty level is reachable with a good understanding of WinUI help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. kind/bug Something isn't working platform/wasm 🌐 Categorizes an issue or PR as relevant to the WebAssembly platform project/items 🧾 Categorizes an issue or PR as relevant to items (ItemsControl, ItemsRepeater, ...)
Projects
None yet
Development

No branches or pull requests

8 participants