Fields become groupby fields once corresponding FieldSortDescription objects, whose FieldSortDescription.IsGroupBy properties were set to true, have been added to the Owner's FieldLayout.SortedFields collection.
In order to initialize a field as a groupby field you need to add a corresponding FieldSortDescription object to the FieldLayout's FieldLayout.SortedFields collection in response to the DataPresenterBase's FieldLayoutInitialized event.
Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2