Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 58056

Layout transforms?

$
0
0

After poking around with VisualElement.TranslationX and VisualElement.TranslationY I'm finding that they are render transforms and not layout transforms meaning they affect where the views are displayed but not taken into account when determining the bounds of the view. Is there any way to have these values applied during measure/layout? At the moment I've had to make a custom ContentView to wrap the element I want translated and do the transformations.

In a bit more detail of my situation - I need to have a view offset outside the parent view by half of its height. I made an attached property to do this and it works fine except that the full height is used during the measure cycle and so there is a ton of whitespace where the control would have been.

I couldn't figure out how to get AbsoluteLayout or RelativeLayout to work because the view is being offset relative to it's own properties. If anyone can think of a way to make this work I'd be all ears!

I also tried making an attached property that did a layout on the element to the adjusted bounds but this didn't affect the parents layout of the rest of its children. When I called ForceLayout on the parent layout it didn't know anything about my custom layout and reset the view back to it's non-translated position.


Viewing all articles
Browse latest Browse all 58056

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>