Forum Cross Platform with Xamarin
We are excited to announce that the Xamarin Forums are moving to the new Microsoft Q&A experience. Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

We encourage you to head over to Microsoft Q&A for .NET for posting new questions and get involved today.

Why listView appears on android project and don't on UWP?

Hello everyone
i'm folowing the Xamarin cross-platform tutoriels provided by xamarin university, and when i add a simple ListView on the MainPage XAML then build both Android and UWP projects the list view doesn't display on the UWP but on android it works.

Answers

  • ClintStLaurentClintStLaurent USUniversity ✭✭✭✭✭

    Change the background color to something unmistakable like fuschia.
    Then hard-set the size so it displays whether there is content or not.

    I'm going to bet you'll see a big empty pink box with no items.
    If that's the case, then the ListView is there, its just empty.

  • Oussama_HJMOussama_HJM Member ✭✭

    I changed the BackgroundColor to black and it appears on both sides(Android and UWP), on Andoid data appears too but unfortunately i got just a black screen on UWP .

  • ClintStLaurentClintStLaurent USUniversity ✭✭✭✭✭
    edited August 2018

    Are you specifying text color?
    I bet its black on black.

    If that pink is specified for UWP as well... Then you just have a problem with data and not the ListView itself.

  • Oussama_HJMOussama_HJM Member ✭✭

    yes i changed TextColor and still the same issue.
    if it was a problem with the data it will not appear even on Android i think.

  • ClintStLaurentClintStLaurent USUniversity ✭✭✭✭✭

    No way to tell from here. There are a dozen things that could go wrong just with the data. Maybe the REST call fetching the data only fails on UWP; as an example. Maybe the local database holding the data is blank just on the UWP device.

    Personally I try to initialize all data, all properties all collections so I can determine that in places like this. If the collection has at least one element where all the properties read "DefaultValue" from the constructor, then you know.

    Breakpoints where you retreive the data would probably show a lot.

  • mchasemchase Member

    I had the same problem of listview contents appearing in Android but not UWP. The data made it to the listview when looking at the list count, but the values did not show in UWP but displayed normally on Android. I tried all sorts of things....hours of changes, reversion to original code....and the final change was simple: I removed VerticalOptions = "EndAndExpand". Worked like a champ on both Android and UWP.

Sign In or Register to comment.