microsoft / WindowsCompositionSamples

The Windows Composition Samples have moved here: https://github.com/microsoft/WindowsAppSDK-Samples/tree/main/Samples/SceneGraph
https://github.com/microsoft/WindowsAppSDK-Samples/tree/main/Samples/SceneGraph
MIT License
1.12k stars 287 forks source link

Question about Translation property #335

Closed HppZ closed 5 years ago

HppZ commented 5 years ago

why don't you just add Translation property on Visual? and ElementCompositionPreview.SetIsTranslationEnabled this API looks strange.

visual.StartAnimation("Translation.Y", animation); since there is no Translation on Visual, why we can StartAnimation on Translation.Y?

Massimo37 commented 5 years ago

Read about it here:

https://github.com/Microsoft/WindowsCompositionSamples/issues/145#issuecomment-240457826

and here (at the bottom, Translation Property section):

https://blogs.windows.com/windowsdeveloper/2017/06/22/sweet-ui-made-possible-easy-windows-ui-windows-10-creators-update/

This was added after Composition came out. That is why Offset exists alongside Translation. Translation does not exist on a Visual, SetIsTranslationEnabled injects the property instead.

HppZ commented 5 years ago

thanks @Massimo37

Massimo37 commented 5 years ago

👍