microsoft / microsoft-ui-xaml

Windows UI Library: the latest Windows 10 native controls and Fluent styles for your applications
MIT License
6.34k stars 677 forks source link

DragItemsStartingEventArgs is sealed and doesn't provide public constructor #5475

Open hawkerm opened 3 years ago

hawkerm commented 3 years ago

Describe the bug This is the most recent example I have, but all the EventArgs classes being sealed and not having constructors is a big problem when trying to implement custom controls which follow the same API interface as built-in controls.

I'd like to re-use the DragItemsStartingEventArgs to implement my own pair of DragItemsStarting/Completed events on a custom view control which allows its items to be dragged.

However, I can't use the same delegate and events as ListViewBase as the event args class DragItemsStartingEventArgs is sealed and therefore I can't set the properties on it as there's no constructor with parameters.

Expected behavior Able to use built-in event args classes and delegates to create controls with matching APIs to built-in controls.

Version Info WUX 19042 (but looks according to docs this is still the case in WinUI 3)

Windows 10 version Saw the problem?
Insider Build (xxxxx)
October 2020 Update (19042) Yes
May 2020 Update (19041)
November 2019 Update (18363)
May 2019 Update (18362)
October 2018 Update (17763)
April 2018 Update (17134)
Fall Creators Update (16299)
Creators Update (15063)
Device form factor Saw the problem?
Desktop Yes
Xbox
Surface Hub
IoT

Additional context Related to #780

hawkerm commented 3 years ago

I also can't as easily use the underlying DragStartingEventArgs and DropCompletedEvents as easily either, as OriginalSource is set only and I guess generally set by the ListViewBase class?

StephenLPeters commented 3 years ago

@MikeHillberg seems like a good candidate to unseal?

hawkerm commented 3 years ago

KeyRoutedEventArgs is the same (as pretty much every event args class).