Using margin or translation

sastsast Sander StamNLMember
edited February 17 in Cross Platform

What is the difference between margin and translation? Example:

<Label TranslationY="10" Text="Test" />
<Label Margin="0,10,0,0" Text="Test" />

For me the result is the same, both labels have a top-outerspace of 10. I tested both labels in a ViewCell, looks like Translation is faster (saving a layout update?). Are there disadvantages for choosing Translation?


Best Answer


  • sastsast Sander Stam NLMember

    @ClintStLaurent thank you for answering! Clear enough! I misunderstood the difference in relative positioning. For me TranslationY suffice, because the height of the (parent) element is fixed.

  • ClintStLaurentClintStLaurent Clint StLaurent USUniversity ✭✭✭✭✭
    edited February 17

    I would suggest going the other way. Use Margin by default. That's the standard everyone follows and results in the least amount of "WTF is happening with my layout?"

    Use Translate when you have a specific reason to need post-layout re-positioning.

Sign In or Register to comment.