I am trying to bind the count of a DataGridView to a Label.
The following code results in a runtime error saying that it cannot be bound to the Count property.
Binding binding = new Binding("Text", datagridview, "Rows.Count", true); binding.Format += (sender, e) => e.Value = string.Format("{0} items", e.Value); label.DataBindings.Add(binding)
The datasource of the DataGridView is a BindingList (to be more precise, a derived version of the BindList which is sortable and filterable). I also tried to bind to the Count property of the BindingList, but this also failed.
I googled the following solution which somehow wraps the list, but this does not work for me:
http://stackoverflow.com/questions/639894/how-to-bind-a-list-count-to-a-label-in-winforms