Description
Type of issue
Other (describe below)
Description
Thanks for a very nice article.
Following questions:
• Looking at the code for the virtual x-platform control (maui-samples/10.0/UserInterface/Handlers/CreateHandlerDemo/VideoDemos/Controls/Video.cs)
For the Commands I see that there is an event declared for each command. Also the command is mapped to the Event.
In my opinion, this can be much more simplified by omitting the event altogether and map the command to method directly instead of the event.
• Handler PropertyMapper
: It is important to mention, I have noticed that those mapping methods are being called at control instantiation no matter if the relevant property has been implicitly set or not.
So, if – for example – I create a handler for some native control, and that control has a default value for a certain property such as a background color for the sake of simplicity, and you have a property mapper for that very same property, even if you don’t specify a value for that property, the default (native) value will get overwritten by a (blank) value.
So for example:
public void MapUpdateBackgroundColor(MyHandler handler, VitualControl virtual)
{
Handler.PlatformView?.setBackgroundColor(virtual.BackgroundColor);
}
will set the BackgroundColor to a default (0) value overriding the native platform default background color.
Page URL
https://learn.microsoft.com/en-us/dotnet/maui/user-interface/handlers/create?view=net-maui-9.0
Content source URL
https://github.com/dotnet/docs-maui/blob/main/docs/user-interface/handlers/create.md
Document Version Independent Id
c00b995e-dfec-dcac-7951-38d6e05249ea
Platform Id
4e92ed4b-40b0-ba27-aed3-99906c51180b
Article author
Metadata
- ID: c00b995e-dfec-dcac-7951-38d6e05249ea
- PlatformId: 4e92ed4b-40b0-ba27-aed3-99906c51180b
- Service: dotnet-mobile
- Sub-service: dotnet-maui