I want to databind to a collection property, such as Count.
in general, when I data bind I specify data member for the object property in the collection, not for the actual properties collection itself exposes.
for example, I have a list of custom objects. I show them in datagridview. but I also want to show their total count using a separate label. is there a way to do this through databinding?
I imagine that somehow I need to force PropertyManager to be used, instead of CurrentyManager?
I get the following exception. Notice that DataSource is collection and has TotalValue property.
System.ArgumentException: Cannot bind to the property or column TotalValue on the DataSource. Parameter name: dataMember at System.Windows.Forms.BindToObject.CheckBinding() at System.Windows.Forms.Binding.SetListManager(BindingManagerBase bindingManagerBase) at System.Windows.Forms.ListManagerBindingsCollection.AddCore(Binding dataBinding) at System.Windows.Forms.BindingsCollection.Add(Binding binding) at System.Windows.Forms.BindingContext.UpdateBinding(BindingContext newBindingContext, Binding binding) at System.Windows.Forms.Binding.SetBindableComponent(IBindableComponent value) at System.Windows.Forms.ControlBindingsCollection.AddCore(Binding dataBinding) at System.Windows.Forms.BindingsCollection.Add(Binding binding)