* DataGridView.cs: Avoid calling ReBind twice during the initial data
binding.
[Fixes bug #512807]
svn path=/trunk/mcs/; revision=136184
+2009-06-16 Ivan N. Zlatev <contact@i-nz.net>
+
+ * DataGridView.cs: Avoid calling ReBind twice during the initial data
+ binding.
+ [Fixes bug #512807]
+
2009-06-16 Ivan N. Zlatev <contact@i-nz.net>
* DataGridView.cs: Suppress invalidation during data binding.
throw new NotSupportedException ("Type cannot be bound.");
ClearBinding ();
- dataSource = value;
- if (BindingContext != null)
+
+ // Do not set dataSource prior to te BindingContext check because there is some lazy initialization
+ // code which might result in double call to ReBind here and in OnBindingContextChanged
+ if (BindingContext != null) {
+ dataSource = value;
ReBind ();
+ } else {
+ dataSource = value;
+ }
OnDataSourceChanged (EventArgs.Empty);
}
}