Is there any way to collaps dataform groups?

1 Answer 12 Views
DataForm
Christian
Top achievements
Rank 1
Christian asked on 17 Apr 2024, 08:47 AM

I have already tried setting the visibility of the editors to "false" (and also removing them completely), but there is still a remaining height for the group (the green part). This does not disappear even if the ContentPadding is set to 0.

Thanks.

1 Answer, 1 is accepted

Sort by
0
Accepted
Didi
Telerik team
answered on 17 Apr 2024, 02:52 PM

Hello,

I have logged a feature request on your behalf for collapsing groups. Cast your vote for the item here: https://feedback.telerik.com/maui/1649062-dataform-provide-an-option-to-collapse-groups 

Regarding to reducing the space, the option I can suggest is setting the space on layout level:

<telerik:RadDataForm.LayoutDefinition>
    <telerik:DataFormVerticalStackLayout Spacing="0"/>
</telerik:RadDataForm.LayoutDefinition>

 

Regarding to the group header customization:

The group has a HeaderStyle property. You can use it to style the groups. Then set the HeightRequest to the style. Check the code snippet. 

 <ContentPage.Resources>
        <ResourceDictionary>
            <Style TargetType="telerik:DataFormGroupContentView" x:Key="contentstyle">
                <Setter Property="BorderColor" Value="Red"/>
                <Setter Property="BorderThickness" Value="0"/>
            </Style>
            <Style x:Key="GroupHeaderViewStyle" TargetType="telerik:DataFormGroupHeaderView">
                <Setter Property="BorderColor" Value="Black" />
                <Setter Property="BorderThickness" Value="0" />
                <Setter Property="HeightRequest" Value="0" />
                <Setter Property="BackgroundColor" Value="LightGray" />
            </Style>
            <Style x:Key="GroupHeaderLabelStyle" TargetType="Label">
                <Setter Property="TextColor" Value="ForestGreen" />
                <Setter Property="FontSize" Value="0" />
                <Setter Property="VerticalTextAlignment" Value="Center" />
                <Setter Property="HorizontalTextAlignment" Value="Center" />
            </Style>
        </ResourceDictionary>
    </ContentPage.Resources>
    <telerik:RadDataForm x:Name="dataFormGrouping" GroupGenerated="dataFormGrouping_GroupGenerated"
                     Grid.Row="1"
                     AutoGenerateItems="False">
        <telerik:RadDataForm.BindingContext>
            <local:EditorsViewModel/>
        </telerik:RadDataForm.BindingContext>
        <telerik:RadDataForm.LayoutDefinition>
            <telerik:DataFormVerticalStackLayout Spacing="0"/>
        </telerik:RadDataForm.LayoutDefinition>
        <telerik:DataFormGroup BackgroundColor="LightBlue" HeaderText="Personal Information" 
                               HeaderStyle="{StaticResource GroupHeaderViewStyle}" 
                               HeaderLabelStyle="{StaticResource GroupHeaderLabelStyle}"
                               ContentStyle="{StaticResource contentstyle}">
            <telerik:DataFormRadEntryEditor PropertyName="FirstName"/>
            <telerik:DataFormRadNumericEditor PropertyName="People" Minimum="1" Maximum="10"/>
            <telerik:DataFormRadComboBoxEditor PropertyName="Accommodation" HeaderText="Accomodation options"/>
        </telerik:DataFormGroup>
        <telerik:DataFormGroup HeaderText="Select Dates" BackgroundColor="LightCoral">
            <telerik:DataFormRadDatePickerEditor PropertyName="StartDate" HeaderText="From:"/>
            <telerik:DataFormRadDatePickerEditor PropertyName="EndDate" HeaderText="To:"/>
        </telerik:DataFormGroup>
        <telerik:DataFormGroup HeaderText="Additional Information" >
            <telerik:DataFormRadTimeSpanPickerEditor PropertyName="Duration" HeaderText="Duration"/>
            <telerik:DataFormRadCheckBoxEditor PropertyName="Visited" HeaderText="Visited before"/>
        </telerik:DataFormGroup>
    </telerik:RadDataForm>

These are the options I can suggest.

Regards,
Didi
Progress Telerik

A brand new ThemeBuilder course was just added to the Virtual Classroom. The training course was designed to help you get started with ThemeBuilder for styling Telerik and Kendo UI components for your applications. You can check it out at https://learn.telerik.com
Tags
DataForm
Asked by
Christian
Top achievements
Rank 1
Answers by
Didi
Telerik team
Share this question
or