CommunityToolkit / Windows

Collection of controls for WinUI 2, WinUI 3, and Uno Platform developers. Simplifies and demonstrates common developer tasks building experiences for Windows with .NET.
https://aka.ms/windowstoolkitdocs
Other
600 stars 74 forks source link

Port (Framework)Extensions #6

Open niels9001 opened 1 year ago

niels9001 commented 1 year ago

TODO

### Base Porting Checklist
- [x] Component/package name (`CommunityToolkit.WinUI.Extensions`)
- [x] Namespace `CommunityToolkit.WinUI`
- [x] Merge differences from UWP main to WinAppSDK / Uno forks
- [x] Import original doc or setup new doc
- [ ] Needs a refresh/update, and probably split
- [x] Samples
- [ ] Tests
- [ ] All brought over tests pass for UWP/WinAppSDK
- [ ] https://github.com/CommunityToolkit/Windows/issues/134
- [x] Support for WASM via Uno Platform
### Extensions
- [x] FrameworkElementExtensions
- [x] ListViewExtensions
- [x] BitmapIconExtension
- [x] BitmapIconSourceExtension
- [x] EnumValuesExtension
- [x] FontIconExtension
- [x] FontIcoNSourceExtension
- [x] NullableBoolExtension
- [x] OnDeviceExtension
- [x] SymbolIconExtension
- [x] SymbolIconSourceExtension
- [x] MatrixExtensions
- [x] RectExtensions
- [x] RotateTransformExtensions
- [x] SkewTransformExtensions
- [x] TranslateTransformExtensions
- [x] ScrollViewExtensions
- [x] TextBoxExtensions
- [ ] TitleBarExtensions (Blocked: Missing WinUI APIs)
- [ ] ElementExtensions (Blocked: Missing WinUI APIs)
- [ ] ApplicationViewExtensions (Blocked: Missing WinUI APIs)
- [ ] WebViewExtensions (Deprecate in favor of `WebView2`)
- [x] PointExtensions
- [x] RectExtensions
- [x] SizeExtensions
- [x] StringExtensions
- [x] HyperlinkExtensions
- [x] DependencyObjectExtensions
- [x] DispatcherQueueExtensions
### Known issues
### Future improvements
## Notable Changes
- [ ] For FrameworkExtensions, look at https://github.com/CommunityToolkit/Labs-Windows/blob/main/components/SegmentedControl/src/Helpers/FrameworkElementExtensions.cs. Some changes were made that to trigger the extension upon loading.
michael-hawker commented 1 year ago

@niels9001 originally we did a big push in 7.0 to flatten the namespace and remove 'extensions' so they were all consistent across the package for easy usage.

Context:

We could have the component/package maybe be called Extensions if we change the scope of what's inside it, but may want to think about still having a base namespace for some of these things?

@Sergio0694 thoughts?

Sergio0694 commented 1 year ago

Heyoooooo I see a new repo πŸ‘€πŸ‘€πŸ‘€

@michael-hawker Yeah, if we went back and added "Extensions" back it'd be a bit weird. FWIW we also don't use "Extensions" in the .NET Community Toolkit.

michael-hawker commented 1 year ago

Looking at the template that Niels copied I think he may have just used Namespace to mean package/component name? But will clarify in a quick-sync tomorrow. πŸ™‚

niels9001 commented 1 year ago

@Sergio0694 @michael-hawker Oh yeah, I basically just replaced the last bit of namespace from the previous template. So please ignore / update πŸ˜„!

michael-hawker commented 1 year ago

Haha, yeah, I guess that line was a bit more specific to the Converters as they are in their own namespace anyway. (Maybe that's a separate discussion as to if they should remain there.)

Anyway, all good. We'll sort it out and can update these issues all together at our next sync.

michael-hawker commented 1 year ago

4 also needs the WeakEventListener and DispatcherQueue extensons. So we should port those over as well into the general base helpers/extensions place.

Should we have the extensions and helpers together as like a common folder/component name?

michael-hawker commented 1 year ago

We have some extensions in the base Microsoft.Toolkit.Uwp package merging those in with the extensions of Microsoft.Toolkit.Uwp.UI package here.

Then will create a separate Helpers component I think that contains most of the rest?

michael-hawker commented 1 year ago

Currently have not brought over:

I believe the top two work differently in UWP vs. WinAppSDK, so probably need to look at more closely if it makes sense to have them. Also, I believe @niels9001 has some thoughts about Titlebar helpers in general we should investigate for a revamp, especially with the platform doing work to better enable custom titlebars, see https://github.com/microsoft/microsoft-ui-xaml/discussions/8137

The Middle Click Scrolling extensions are dependent on Windowing APIs, Input APIs, and Cursor APIs, which all work very differently between UWP and Windows App SDK, so not porting for now, as I don't think they work for Windows App SDK at the moment, so probably need more attention.

With WebView2 now, we should figure out if we need to remap these extensions or how that should work.