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

DataForm for Xamarin.Android: Linear Layout

RadDataForm can easily arrange its editors in a linear layout instead of the default table layout. This can be done with the DataFormLinearLayoutManager class.

// The context argument of the manager is the app context/activity.
dataForm.LayoutManager = new DataFormLinearLayoutManager(context);

The linear manager can also change its orientation:

linearLayoutManager.Orientation = (int)Android.Widget.Orientation.Horizontal;

Finally, DataFormLinearLayoutManager can be initialized with a special linear layout inflated from XML.

Assuming the app project contains a layout called R.layout.data_form_custom_linear_layout, the manager can be initialized like this:

// Note that the orientation of the linear layout specified in the XML 
// will be overwritten by the orientation of the manager itself.
// Another important detail is that the XML must have the LinearLayout 
// object as the root element.
DataFormLinearLayoutManager manager = 
    new DataFormLinearLayoutManager(context, 
        Resource.Layout.data_form_custom_linear_layout);
In this article