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. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to resize the parent grid and DetailsViewDataGrid simultaneously?

Platform: WPF |
Control: SfDataGrid

In SfDataGrid, while resizing the parent grid column, the DetailsViewDataGrid’s corresponding column is not resized, even if both the parent grid and the DetailsViewDataGrid have the same number of columns. When you want to resize the DetailsViewDataGrid’s columns while resizing the parent grid columns, you can do so with the help of SfDataGrid.DetailsViewLoading event and SfDataGrid.ResizingColumns event of SfDataGrid as shown in the following code examples.


In DetailsViewLoading event, the DetailsViewDataGrid columns width has been set based on the parent grid’s column width. When the parent grid has nested levels, you need to use SfDataGrid.DetailsViewLoading event for all levels. Refer the attached sample for nested level.

In ResizingColumns event, based on new width, after resizing the parent grid column, DetailsViewDataGrid’s column width is set.

Note: In the above examples, GridHelperClass methods are used for resolving Row and Column index in both parent grid and DetailsViewDataGrid.

By default, parent grid and DetailsViewDataGrid have some space in between, since SfDataGrid.DetailsViewPadding is set. For displaying parent grid and DetailsViewDataGrid in the same line, you need to set DetailsViewPadding as 0, as shown in the following code example.


Note: By using the above examples, you can resize the parent grid and the DetailsViewDataGrid columns at the same time, if both the grids have equal number of columns only. It is applicable for nested levels also. The following links contain samples for both single level and nested level DetailsViewDataGrid.

Sample links:




2X faster development

The ultimate WPF UI toolkit to boost your development speed.
You must log in to leave a comment

Please sign in to access our KB

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

Up arrow icon

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

Live Chat Icon For mobile