binding to my current presenter in caliburn without binding convention

谁说我不能喝 提交于 2019-12-03 16:35:54

You should bind to View.Model attached property, which:

  • figures out the correct view to represent the VM
  • binds the view DataContext to the VM
  • pushes the view in the ContentControl's Content property

Example:

<!-- Caliburn v1.x -->
<ContentControl cal:View.Model="{Binding CurrentPresenter}" />

The previous snippet works in Caliburn v1.x, while in Caliburn v2 and Caliburn.Micro IPresesenterManager was renamed into IConductor (with some changes to interface members, too), so the binding should be:

<!-- Caliburn v2 & Caliburn.Micro -->
<ContentControl cal:View.Model="{Binding ActiveItem}" />
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!