Poor performance of WPF user control with ~30 standard controls (textboxes, comboboxes etc...)
I have ListBox bound to list of business objects.
and UserControl. It's DataContext is bound to SelectedItem of ListBox.
UserControl contains ~ 30 TextBoxes, ComboBoxes, CheckBoxes bound to properties of business object.
I use TwoWay data binding mode (to be truly need TwoWay only for ~ 5 controls)
When SelectedItem in listbox changes3-5 sec. pause appears before new selected object will be displayed in user control..
What is the reason of this 3-5 sec. delay? I'm playing on P4 2.4 Mgz, 2GbRam and 256Mb 7600GS Nvidea video WinXP + SP2
Please help!
[626 byte] By [
sergun] at [2008-1-8]
Thirty controls should definitely not be a problem for a WPF application. You mentioned that you're binding to properties of some business objects and seeing poor performance. Are these business objects part of the application itself or do they exist on a remote machine? Do you see the same poor performance when binding to something simple like a chunk of XML or properties on another control? Does changing the binding mode to OneWay affect the performance?
I'd like to try to isolate the root cause here since 30 controls bound to CLR properties is not something I expect to be slow (and I've seen dozens of apps that are far more complex that don't exhibit the problems you're describing).
Thanks!
Dan
Thanks Dan!
I have filled in business object on locally. It is already selected from database completely filled in.
I just set DataContext and show user control.
I didn't try OneWay because not sure that this should help.
Main business object is Building.
It has collection property Premises - set of premisess with their properties.
I have delay when the form is displayed for entire Building
and when another room is selected in rooms ListBox and UserControl with it's properties is showed.
Example of control on my form is as follows:
Code Snippet
<Label Content="{Binding Source={x:Static domain:BindableBase.Properties}, Path=[Premise.State][name], Mode=OneTime}" Grid.Row="3" Grid.Column="0"/>
<ComboBox ItemsSource="{Binding Source={x:Static domain:BindableBase.Enums}, Path=[PremiseStateEn][data].List}"
DisplayMemberPath="Text"
SelectedValuePath="Id"
SelectedValue="{Binding Path=State}"
Width="120"
Grid.Row="3" Grid.Column="1"/>
Texts of labels, alternatives in comboboxes are retrieved from static dictionaries.
I read somewhere in MSDN that label shows poor performance in comparsion to textblock but
I didn't play with this since I think the reason is either incorrect way I use WPF or WPF implementation.
Sergey.
Thanks. Your advise helped me.
The problm was with Validator control from CSLA library I used..
Hmm.. It's open new question reg. good and fast template for validation in WPF
since walk through all controls or bindings like in CSLA or Paul Stawell validations works slow.