New to Telerik UI for Xamarin? Download free 30-day trial

DataForm for Xamarin.iOS: Group Layouts

TKEntityPropertyGroupView allows you to arrange the editors in the group using different layouts that confirm to TKLayout protocol through its Layout property. By default the group view uses TKStackLayout, but you could easily change it to let's say TKGridLayout. The code snippet below shows how to change the layout of a group view inside the UpdateGroupView method of the DataForm Delegate:

class MyDataFormDelegate : TKDataFormDelegate
{
    public override void UpdateGroupView (TKDataForm dataForm, TKEntityPropertyGroupView groupView, uint groupIndex)
    {
        groupView.Collapsible = true;
        if (groupIndex == 0) {
            TKGridLayout grid = new TKGridLayout ();
            groupView.EditorsContainer.Layout = grid;
            int row = 0;
            int col = 0;
            foreach (UIView editor in groupView.EditorsContainer.Items) {
                TKGridLayoutCellDefinition editorDefinition = grid.DefinitionForView (editor);
                editorDefinition.Row = new NSNumber (row);
                editorDefinition.Column = new NSNumber (col);
                col++;
                if (col == 2) {
                    row++;
                    col = 0;
                }
            }
        }   
    }
}
In this article