I am new to using Xamarin.Forms to develop an app for both Android and iOS. I have been having a problem for the past week or so that I can't wrap my head around.
Basically, I am implementing custom renderers for custom controls. The parent control inherits from AbsoluteLayout (a "Canvas" of sorts for the children) and the children are objects that inherit from Frame. I am trying to create the ability to have the user move and resize the custom Frame objects.
I have managed to get the objects to move and update their position inside the AbsoluteLayout when they are touched and dragged. Great! Now on to resizing the Frames. I understand that I cannot change the width or height directly, and have to make a call to Width/HeightRequest, which then basically asks the parent if it can update, and the rest of the layout cycle occurs for the AbsoluteLayout. When I try to invoke the following code in the custom renderer,
Element.WidthRequest += 1.0;
the position of the Frame always resets to (0,0) inside the AbsoluteLayout (after the resize occurs). So I know that the frames can update their width and height, but the automatic position change is undesirable.
I have been unsuccessful in capturing this change in position through PropertyChanged events, and have scoured through results on Google to try many things (such as overriding the AbsoluteLayout's OnChildMeasureInvalidated() to not let that base method execute). Nothing has worked thus far.
Any ideas? It would be greatly appreciated!