Slow Databinding setup time in C# .NET 4.0
Posted
by Svisstack
on Stack Overflow
See other posts from Stack Overflow
or by Svisstack
Published on 2010-05-07T11:37:20Z
Indexed on
2010/05/07
11:48 UTC
Read the original article
Hit count: 331
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 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?
© Stack Overflow or respective owner