gpt4 book ai didi

mvvm - 禁用给定 V/VM 对的 Caliburn.Micro View/ViewModel 绑定(bind)约定

转载 作者:行者123 更新时间:2023-12-03 10:28:12 27 4
gpt4 key购买 nike

我喜欢 Caliburn Micro,但我在这里遇到了一些困难:

我想手动为给定的 ViewModel 子类型定义一个 DataTemplate,但我不知道如何禁用基于名称的自动约定。

最佳答案

来自 "All About Conventions(Caliburn.Micro")文档:

Should you decide that you don’t like the behavior of the ViewModelBinder (more details below), it follows the same patterns as the above framework services. It has several Funcs you can replace with your own implementations, such as Bind, BindActions and BindProperties. Probably the most important aspect of customization though, is the ability to turn off the binder’s convention features. To do this, set ViewModelBinder.ApplyConventionsByDefault to false. If you want to enable it on a view-by-view basis, you can set the View.ApplyConventions attached property to true on your View. This attached property works both ways. So, if you have conventions on by default, but need to turn them off on a view-by-view basis, you just set this property to false.

关于mvvm - 禁用给定 V/VM 对的 Caliburn.Micro View/ViewModel 绑定(bind)约定,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26715868/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com