.NET MAUI is the .NET Multi-platform App UI, a framework for building native device applications spanning mobile, tablet, and desktop.
22.27k
stars
1.76k
forks
source link
[Windows] Fix crash setting MenuFlyoutSubItem IconImageSource #26021
Open
jsuarezruiz opened 3 days ago
Description of Change
Fix crash setting
MenuFlyoutSubItem
IconImageSource on Windows.From https://github.com/dotnet/maui/pull/24688 the ImageSource is added as logical children of the menu item. However, the
LogicalChildrenInternalBackingStore
collection from MenuFlyoutSubItem does a casting toIMenuElement
https://github.com/dotnet/maui/blob/5b5aaa5ef83f54688bee408cf14768f443d5aa2e/src/Controls/src/Core/Menu/MenuFlyoutSubItem.cs#L19Trying to add the IconImageSource to the LogicalChildrenInternalBackingStore insert a null value because this casting https://github.com/dotnet/maui/blob/5b5aaa5ef83f54688bee408cf14768f443d5aa2e/src/Controls/src/Core/ReadOnlyCastingList.cs#L91 fails, cannot convert from Element to
IMenuElement
.This PR apply changes to allow Element in the
LogicalChildrenInternalBackingStore
collection from MenuFlyoutSubItem.Issues Fixed
Fixes #25893