.NET MAUI Picker displays "Microsoft.Maui.Controls.ViewCell" on windows if ItemsSource has an empty string
- Dominant language
- C#
- Stars
- 23.3k
- Forks
- 2k
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 296
Description
### Description
This issue is essentially identical to #24276 except the Picker control displays the parent control name when ItemsSource has an empty string as an option. In this case, the Picker control is a child of a ViewCell in a TableView. I'm not convinced PR 8845 fully solved the bug identified by #24276. However, this may be a completely different issue with identical behavior with a parent control. I just used the current defaults of Visual Studio 17.13.6 when generating a new MAUI app, with the exception of updating the .NET MAUI packages to 9.0.0.60. .NET MAUI windows workload version = 9.0.14


### Steps to Reproduce
The easiest way to repro this issue is to use the repro repo that has everything setup.
1) Create new MAUI project with no sample content
2) Install Community MVVM package
3) Create view model with a single string observable property (default of string.Empty) and register the ViewModel in DI container
4) Inject the ViewModel into the MainPage constructor and set the data context
5) Add a TableView control with a single ViewCell containing a Picker control, set the SelectedItem binding to the property of the ViewModel
6) Run the application
### Link to public reproduction project repository
https://github.com/bteamsoftware/MauiPicker24276.git
### Version with bug
9.0.60 SR6
### Is this a regression from previous behavior?
Not sure, did not test other versions
### Last version that worked well
_No response_
### Affected platforms
I was *not* able test on other platforms
### Affected platform versions
Windows SDK 10.0.17763.0
### Did you find any workaround?
Issue #24276 suggests creating an object list and binding to that list using ItemDisplayBinding. I'm too early in development to go to that effort, however, another option would be to not use an empty option in the Picker then convert it to a null value prior to saving to the database to indicate no option is selected. When calculations happen, it would be very nice to only select rows where the value is null rather than hard coding some value.
### Relevant log output
```shell
```
Contributor guide
Research direction
Start with the public reproduction repository, MauiPicker24276, and run the Windows app using a TableView containing a ViewCell and Picker bound to an empty string. Trace the Picker's displayed item and parent-control handling; done means the empty option displays as blank rather than Microsoft.Maui.Controls.ViewCell, without regressing the related #24276 behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- desktop, frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100