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.
Unfortunately, activation email could not send to your email. Please try again.

counting number of rows in DataGridControl

Thread ID:





114534 Nov 22,2013 03:25 PM Dec 4,2013 07:47 AM WPF 2
Tags: GridControl
Joseph Lopez
Asked On November 22, 2013 03:25 PM

I need a way to hide the data grid control when there are no records. In the native WPF implementation it would be done like this:
DependencyObject obj = (DependencyObject)e.OriginalSource;
            if (obj is DataGrid)
                if ((obj as DataGrid).Items.Count == 0)
                    (obj as DataGrid).Visibility = Visibility.Collapsed;

however items is not a property on the WPF Data Grid Control. How can this be done? thanks

Joseph Lopez
Replied On November 22, 2013 03:30 PM

found it

if ((obj as Syncfusion.Windows.Controls.Grid.GridDataControl).Model.RowCount <= 1) //header is counted
                    (obj as Syncfusion.Windows.Controls.Grid.GridDataControl).Visibility = Visibility.Collapsed;

Saravanan M [Syncfusion]
Replied On December 4, 2013 07:47 AM

Hi Joseph,

Thanks for you update,

You can also get the Rowcount by applying below code snippet.


int count = this.syncgrid.Model.RowCount;


Please let us know if you have any queries,




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.

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.