I'm using a RadGridView in my WPF projet and when I load my form, I assign the ItemsSource property of my RadGridView to an object representing an array of values. After that, I'm trying to display a label with the number of items in my grid but the RadGridView.Items.Count method always return 0.
Here is what I'm doing:
RadGridView.ItemsSource; = itemsGrid //Actually, itemsGrid contain 11 elements
GroupBox.Header = RadGridView.Items.Count.ToString(); //Always return 0.
But I can see the 11 elements in my grid!!!
Can you explain this???
Thank's
6 Answers, 1 is accepted
It will be better to bind such properties since the grid will not create everything immediately when you assign ItemsSource.
Kind regards,Vlad
the Telerik team
any idea if this was ever solved ? I need to display the custom message that has the count value of number of rows in the grid.
I can't use the collection view that is bound to the grid as the user could have applied some column level filters on the grid.
My collection could have 1000 items but grid might be showing only 10 based on grid filters.
How do I get the correct number of rows being displayed on the grid.
You can try using the Items collection of RadGridView, as the control performs all data operations, such as filtering over it.
Hope this helps.
Regards,
Stefan X1
Telerik
Hello, guys. I am in similar situation. But I binded text box to Items.Count property. And I faced with this problem too. But I found an interesting issue - if I set DataLoadMoad="Asynchronous" for RadGridView - all works correct. So I have a big question - why it does working good in async mode (Items.Count return right value) but does not work in sync mode?
Hello, guys.
I faced this problem too. But I have binded text box to Items.Count property of RadGridView. And I found an interesting solution for this problem. If i set DataLoadMode="Asynchronous" for RadGridView - than all works correct. But in synchrous mode Items.Count returns 0 on first initizlization.
Support, could you please answer why in async mode Items.Count works correct and works bad in sync mode? It bother me because of on Telerik tips and tricks async mode is not recommended to use.
I responded in the other forum thread you opened. May I kindly ask you to continue any further communication on this issue there so that we can keep the conversation history in tact?
Thank you in advance for your cooperation on the matter.
Regards,
Dilyan Traykov
Progress Telerik