We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Indent column width when grouping with SfDataGrid

Thread ID:





123159 Feb 22,2016 10:40 AM UTC Feb 25,2016 05:59 AM UTC WPF 3
Tags: SfDataGrid
Adam Risberg
Asked On February 22, 2016 10:40 AM UTC

When using the grouping feature of sfDataGrid, the contained rows of each group are indented to make room for the expand arrow. I didn't need/want that arrow because my groups are always expanded and was able to remove it with a custom template in Blend. However, the indent still exists. As far as I can tell, the indenting is created with a column that I can't figure out how to access. Is there any way to remove, hide, or at least change the width of that auto generated indent column?

Sowndaiyan Paulpandi [Syncfusion]
Replied On February 23, 2016 11:28 AM UTC

Hi Adam,

Thanks for contacting Syncfusion Support.

In SfDataGrid , you can achieve your requirement by customizing the style of  GridExpanderCellControl” like the below code example,



        <Style TargetType="syncfusion:GridExpanderCellControl">

            <Setter Property="Visibility" Value="Hidden" />





Adam Risberg
Replied On February 24, 2016 07:45 AM UTC

That removes the expander arrow, but I'm trying to remove (or at least change the width of) the actual indent columns shown in the attached image. Is there any way to do that?

Attachment: DataGridColumnImage_61efee17.zip

Sivakumar R [Syncfusion]
Replied On February 25, 2016 05:59 AM UTC

Hi Adam,

You can hide the indent columns by changing it’s width to zero. Refer the below code snippet where indent columns are hided while loading and also at runtime.

this.datagrid.GroupColumnDescriptions.CollectionChanged += GroupColumnDescriptions_CollectionChanged;

this.datagrid.ItemsSourceChanged += Datagrid_ItemsSourceChanged;

//Hides indent columns if you have grouped while loading by adding GroupColumnDescriptions

private void Datagrid_ItemsSourceChanged(object sender, GridItemsSourceChangedEventArgs e)


    if (e.NewItemsSource != null)



//Hides indents columns when grouping at runtime  

private void GroupColumnDescriptions_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)




private void HideIndentColumns()


    if (this.datagrid.View == null)


    this.datagrid.Dispatcher.BeginInvoke(new Action(() =>


        int start = this.datagrid.ShowRowHeader ? 1 : 0;

        for (int i = start; i < this.datagrid.GroupColumnDescriptions.Count + start; i++)


            this.datagrid.GetVisualContainer().ColumnWidths[i] = 0;


    }), DispatcherPriority.ApplicationIdle);



This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon