How can we get Number of rows Present in Listview?
It can't work...
atul gupta
2010-06-30 14:34:33
@atul What problem are you seeing? Without more information, it's hard to provide alternative that would work for you.
Andy
2010-06-30 17:44:21
Sorry Andy I Forgot to tell that i m working in MVVM Pattern, i hv to count rows of Listview in ViewModel. well in MVVM Pattern Viewmodel Doesn't know about view then hw can i use Listview.Items.Count????
atul gupta
2010-07-01 04:45:56
What about @Kevin's suggestion to use the count of the collection bound to the control?
Andy
2010-07-01 11:15:52
+1
A:
Well, you see. When you bind a list view to some sort of collection (preferably some sort of observable collection) with some sort of type. You can add/remove.
But you also have the functionality to say observablecollection.count.
Now if you are adding the items inside the XAML. a quick and easy way to access it is.
x:Name="name of the list" then in the code behind say (name of the list).count.
That should give you access within the code behind, or if you don't want to do it in the code behind. You will need some sort of window dictionary.
and you can access the (name of the list) through your dictionary.
Kevin
2010-06-30 14:02:11
By the way, if you are using the model-view-viewmodel practice. in which i use. You should bind your list view to some sort of observable collection.
Kevin
2010-07-08 20:01:50