简体   繁体   English

wpf 4.5控件速度慢,有滞后

[英]wpf 4.5 controls are slow, have lag

I have a wpf 4.5 application where I am trying to trouble shoot why my controls are slow, or have lag with the user input. 我有一个wpf 4.5应用程序,在这里我试图解决为什么我的控件运行缓慢或用户输入滞后的问题。 If a user tabs between control, like textboxes, or changes the text of a textbox there is a serious lag between the user typing and the text appearing in the text box. 如果用户在控件(例如文本框)之间切换,或更改文本框的文本,则在用户键入内容和出现在文本框中的文本之间存在严重的滞后。

For example: A textbox declaration 例如:文本框声明

<TextBox x:Name="chrTitle" 
         Style="{StaticResource FTC_ValidateTextBox}" 
         Grid.Column="1" Grid.ColumnSpan="2" Grid.Row="1"
         Text="{Binding chrTitle, Mode=TwoWay, ValidatesOnDataErrors=True, UpdateSourceTrigger=PropertyChanged}" />

I thought it might be the validation so: I have tried removing the ValidatesOnDataErrors and changing the UpdateSourceTrigger to lostfocus, property changed and explicit. 我认为这可能是验证,所以:我尝试删除ValidatesOnDataErrors并将UpdateSourceTrigger更改为lostfocus,属性更改为显式。 With no improvement. 没有改善。

I thought it might be a style or binding related issue so: I also set the style to x:Null and I removed the binding al together, both also gave no improvement. 我认为这可能是与样式或绑定有关的问题,因此:我也将样式设置为x:Null,并且一起删除了绑定al,但都没有任何改善。

This affects other controls like drop downs. 这会影响其他控件,例如下拉菜单。

Question: 题:

Can someone help me trouble shoot what in my application is causing input lag with controls like textboxes and dropdowns. 有人可以帮我解决一下应用程序中什么导致输入滞后的问题,例如文本框和下拉菜单。

In my experience with slow WPF applications, common causes can be: 以我使用慢速WPF应用程序的经验,常见原因可能是:

  1. broken bindings, 绑定断开

  2. unstopped storyboards 不停的故事板

  3. inefficient command CanExecute functions 效率低下的命令CanExecute函数

This would be the first place to start 这将是第一个开始的地方

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM