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

  • Question

  • User371708 posted

    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.

    Monday, August 6, 2018 5:33 PM

All replies

  • User180523 posted

    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.

    Monday, August 6, 2018 5:37 PM
  • User371708 posted

    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 .

    Monday, August 6, 2018 6:07 PM
  • User180523 posted

    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.

    Monday, August 6, 2018 6:15 PM
  • User371708 posted

    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.

    Monday, August 6, 2018 6:30 PM
  • User180523 posted

    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.

    Monday, August 6, 2018 6:50 PM
  • User389740 posted

    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.

    Saturday, December 21, 2019 6:15 PM