You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In assembly Uno.UI, Windows.UI.Xaml.DependencyObject is defined as an interface. This is different from regular UWP, where DependencyObject is a class being derived from interfaces IDependencyObject and IDependencyObject2.
I have classes derived from DependencyObject and this prevents code-sharing between UWP and my evaluation port.
Any specific reason for doing so and violating UWP naming conventions? In the first place I did not even realize this is just an interface in Uno...
DependencyObject is an interface to give the ability for Xaml controls to inherit directly from native controls, for performance reasons.
That being said, there should not be any significant issue from porting code that uses DependencyObject, aside from where DependencyObject is used a generic constraint.
Do you use UWP's IDependencyObject and IDependencyObject2, and if so why ?
Just one more questions: Do I have to make my classes partial then?
I can see that the intellisense no more flags the DependencyObject related issues, but the build fails
error CS0260: Missing partial modifier on declaration of type 'XY'; another partial declaration of this type exists
If I add the partial modifier, it compiles without any errors.
Correct, I missed that part in my original answer. The only way for the generator to fill the gaps is through partial classes. This change is transparent for UWP.
Activity
jeromelaban commentedon Jun 5, 2018
DependencyObjectis an interface to give the ability for Xaml controls to inherit directly from native controls, for performance reasons.That being said, there should not be any significant issue from porting code that uses DependencyObject, aside from where DependencyObject is used a generic constraint.
Do you use UWP's
IDependencyObjectandIDependencyObject2, and if so why ?queequac commentedon Jun 5, 2018
I have classes being derived directly from DependencyObject, to be used in Xaml just like Behaviors.
jeromelaban commentedon Jun 5, 2018
Then it should be supported without any difference. Inherit from DependencyObject like you would in UWP, the code generator will fill the gaps.
You'll notice that Intellisense will flag the interface as not implemented until you build the first time, then the warning should go away.
This is a known VS limitation that you can address using this: https://github.com/nventive/Uno.SourceGeneration#generated-code--intellisense
queequac commentedon Jun 5, 2018
Thanks for pointing this out! Was completely unaware of this. :)
queequac commentedon Jun 5, 2018
Just one more questions: Do I have to make my classes partial then?
I can see that the intellisense no more flags the DependencyObject related issues, but the build fails
If I add the partial modifier, it compiles without any errors.
jeromelaban commentedon Jun 5, 2018
Correct, I missed that part in my original answer. The only way for the generator to fill the gaps is through partial classes. This change is transparent for UWP.
Wasm appicon for pwa and favicon for everyone (unoplatform#25)
chore: MOAR LOGGING
chore: MOAR LOGGING