microsoft / XamlBehaviors

This is the official home for UWP XAML Behaviors on GitHub.
MIT License
692 stars 110 forks source link

Put everything in a single namespace #209

Open michael-hawker opened 3 years ago

michael-hawker commented 3 years ago

I love the behaviors package, but one of the things that makes it hard to use and add in easily is the fact that I need to know 2-3 different namespaces to actually implement anything in my XAML. It's just a lot of extra manual work to have to remember which one to use on each behavior/trigger/action I want to use.

It'd be great to condense the library down to a single namespace, so then it's easy to just do:

   <i:Interaction.Behaviors>
     <i:EventTriggerBehavior EventName="Click">
       <i:PlaySoundAction Source="Asset/Ding.mp3"/>
     </i:EventTriggerBehavior>
   </i:Interaction.Behaviors>

Then all I have to remember is Interaction.Behaviors to get me started, and VS can help me include the single namespace at that point.

pedrolamas commented 3 years ago

Now that, I can relate to!

It would be a major breaking change (as it breaks with quite a few years of legacy), so this is not something I would decide on my own, but surely support to make things easier.

If we do go ahead with such a change, then a new major version increment needs to be pushed.

sonnemaf commented 3 years ago

I love to have them all in one namespace. I never understood why there where two.

I understand it is a major version increment. WinUI is doing a similar thing with version 3, it is also a namespace change. Please do this too.

michael-hawker commented 3 years ago

@sonnemaf good point, time to do this would be the transition to WinUI with the WinUI package. 🙂

Noemata commented 3 years ago

I'm curious what suggestions @sonnemaf and @michael-hawker would have regarding maintaining XAML code that needs to work in multiple namespaces. How would I conditionally compile between current WinUI, UWP and future WinUI namespaces? The C# side of this is easy with pragmas. I haven't found anything as simple to for XAML?

The other nice to have would be a mechanism that would allow XAML Styles to use x:Bind through some sort of "hint".

Noemata commented 3 years ago

Now that, I can relate to!

It would be a major breaking change (as it breaks with quite a few years of legacy), so this is not something I would decide on my own, but surely support to make things easier.

If we do go ahead with such a change, then a new major version increment needs to be pushed.

Create a different Nuget package with a different name. It's an opt in approach that only new projects would use, thus not having any effect on legacy apps. Microsoft does that sort of thing already.