I was doing this in my cell xaml:
<?xml version="1.0" encoding="UTF-8"?>
</ViewCell>
I then have this in my code behind
public PanelCategoryCell ()
{
InitializeComponent ();
var accountManager = Resolver.Resolve < AccountManager > ();
var size = AppHelper.ScreenSize;
//TODO this isn't ideal, as it's not top down layout
AbsoluteLayout.SetLayoutFlags (CategoryLabel, AbsoluteLayoutFlags.None);
AbsoluteLayout.SetLayoutFlags (VideosGrid, AbsoluteLayoutFlags.None);
AbsoluteLayout.SetLayoutFlags (VideosGrid, AbsoluteLayoutFlags.None);
CategoryLabel.Layout (new Rectangle (0, 0, size.Width, 20));
VideosGrid.Layout (new Rectangle (0, 20, size.Width, CellHeight - 20));
_spinner = new ActivityIndicator () {
Color = Color.White,
IsRunning = false,
};
_items = new ObservableCollection<IVideo> ();
AbsoluteLayout.SetLayoutFlags (_spinner, AbsoluteLayoutFlags.None);
Layout.Children.Add (_spinner, new Rectangle (140, 60, 40, 40));
var category = new VideoCategory () {
Name = "SPORTS",
};
LoadVideos (category);
}
It just totally ignores my layout calls, and fails to lay things out as I specify and doens't set width or height on the label.
how are we meant to create layout children in xaml; but change their sizes in code, inside of a viewcell. I would imagine this is a very common thing to do, as presumably it's the most efficient, and is essential for doign things like showing spinner overlays/status overlay images on cells, etc.
Edit - I added a call to Layout.ForceLayout().. but it still ignores the y size of my gridview.