I am implementing the Model-View-ViewModel (MVVM) pattern in one of the forms of my SL2 appication using INotifyPropertyChanged interface and TwoWay Databinding.
我正在使用INotifyPropertyChanged接口和TwoWay Databinding以我的SL2应用程序的一种形式实现Model-View-ViewModel(MVVM)模式。
However I feel that due to this approach, my form behaves slightly sluggishly.
但是我觉得由于这种方法,我的形式表现得有些缓慢。
I just wanted to know whether using this approach is there any performance hit in such SL2 applications.
我只是想知道使用这种方法是否在这样的SL2应用程序中有任何性能损失。
Thanks... Sudeep
4 个解决方案
#1
I have not noticed any slowdown. We are doing a LOT of binding to INotifyPropertyChanged ViewModels and the UI seems to be extremely responsive.
我没有注意到任何减速。我们正在对INotifyPropertyChanged ViewModels进行大量绑定,并且UI似乎反响灵敏。
Sure, there will be a hit for data binding vs direct data access... but that hit is so small that the benefit you get from data binding makes the small hit inconsequential.
当然,数据绑定与直接数据访问相比会受到打击......但是这种打击非常小,以至于您从数据绑定中获得的好处使得小打击无关紧要。
Something to remember: The data binding is happening in the UI. There isn't a lot of high intensity processing happening at that layer. In addition, the UI renders on a separate thread. Those two things together make for an experience that feels very responsive, in my opinion.
要记住的事情:数据绑定发生在UI中。在该层没有发生很多高强度处理。此外,UI呈现在单独的线程上。在我看来,这两件事共同构成了一种感觉非常敏感的体验。
Erik asked if you have any Value Converters in place? I would ask the same thing. If so, are they doing a lot of work? In my experience with MVVM, value converters are rarely needed anymore. Just some food for thought.
Erik问你是否有任何价值转换器?我会问同样的事情。如果是这样,他们做了很多工作吗?根据我使用MVVM的经验,很少需要值转换器。只是一些值得思考的东西。
#2
I haven't noticed any slowdown. The Prism Reference Implementation, among many others, seems to be fast.
我没有注意到任何减速。 Prism Reference Implementation和其他许多实现似乎很快。
In fact, the binding system uses dependency properties. Just like the animation system. Part of the reason is that the values can be updated quickly by the framework.
实际上,绑定系统使用依赖属性。就像动画系统一样。部分原因是框架可以快速更新值。
Do you have any Value Converters in place?
你有没有价值转换器?
#3
We do a lot of MVVM with Prism and haven't noticed a performance hit. Quite the opposite - the app often demos faster than it's low-tech Windows counterpart.
我们用Prism做了很多MVVM,并没有发现性能受到影响。恰恰相反 - 该应用程序通常比低技术Windows对应程序更快地进行演示。
#4
Check as well in which places you need two way binding in which other just one time binding.
检查您需要双向绑定的位置,其他只需一次绑定。
#1
I have not noticed any slowdown. We are doing a LOT of binding to INotifyPropertyChanged ViewModels and the UI seems to be extremely responsive.
我没有注意到任何减速。我们正在对INotifyPropertyChanged ViewModels进行大量绑定,并且UI似乎反响灵敏。
Sure, there will be a hit for data binding vs direct data access... but that hit is so small that the benefit you get from data binding makes the small hit inconsequential.
当然,数据绑定与直接数据访问相比会受到打击......但是这种打击非常小,以至于您从数据绑定中获得的好处使得小打击无关紧要。
Something to remember: The data binding is happening in the UI. There isn't a lot of high intensity processing happening at that layer. In addition, the UI renders on a separate thread. Those two things together make for an experience that feels very responsive, in my opinion.
要记住的事情:数据绑定发生在UI中。在该层没有发生很多高强度处理。此外,UI呈现在单独的线程上。在我看来,这两件事共同构成了一种感觉非常敏感的体验。
Erik asked if you have any Value Converters in place? I would ask the same thing. If so, are they doing a lot of work? In my experience with MVVM, value converters are rarely needed anymore. Just some food for thought.
Erik问你是否有任何价值转换器?我会问同样的事情。如果是这样,他们做了很多工作吗?根据我使用MVVM的经验,很少需要值转换器。只是一些值得思考的东西。
#2
I haven't noticed any slowdown. The Prism Reference Implementation, among many others, seems to be fast.
我没有注意到任何减速。 Prism Reference Implementation和其他许多实现似乎很快。
In fact, the binding system uses dependency properties. Just like the animation system. Part of the reason is that the values can be updated quickly by the framework.
实际上,绑定系统使用依赖属性。就像动画系统一样。部分原因是框架可以快速更新值。
Do you have any Value Converters in place?
你有没有价值转换器?
#3
We do a lot of MVVM with Prism and haven't noticed a performance hit. Quite the opposite - the app often demos faster than it's low-tech Windows counterpart.
我们用Prism做了很多MVVM,并没有发现性能受到影响。恰恰相反 - 该应用程序通常比低技术Windows对应程序更快地进行演示。
#4
Check as well in which places you need two way binding in which other just one time binding.
检查您需要双向绑定的位置,其他只需一次绑定。