Hello,
I have got a problem. I have windows forms application with dynamic generated layout, but i have a problem in performance. In this form i use DataBinding
from .NET 4.0
and databinding after setup works fine, but he binding setup time for ONE control blocking my application on approx 0.7 second. I have some controls and time of binging setuping is around 2 minutes.
I trying all possible solutions, I dont have any ideas without write self binding class. Why is wrong with my code?
case "Boolean":
{
Binding b = new Binding("Checked", __bindingsource, __ep.Name);
CheckBox cb = new CheckBox();
/*
* HERE is the start of problem
*/
cb.DataBindings.Add(b);
/*
* HERE is the end of problem
*/
__flp.Controls.Add(cb);
__bindingcontrol.AddBinding(b);
break;
}
Without problem code lines all works fast and without binding ;-( but i want binding turn on in normal speed.
PS1. I have suspended layout in generation time.
PS2. I have same problem with binding TextBox'es, PictureBoxe's, CheckBox is only example.
How to do that or more littley how to debug the problem, the vs2010 profiler says only the problem is the Binding and i know that.
- System.Windows.Forms.Control.ControlCollection.Add(class System.Windows.Forms.Control)
- System.Windows.Forms.ControlBindingsCollection.Add(class System.Windows.Forms.Binding)
EDIT: DataContext is from database. (Entity Framework)