WPF // MahApps.Metro // Caliburn.Micro // Flyout // HeaderedContentControl

三世轮回 提交于 2019-12-06 12:07:26

While I haven't tried it myself but since the new Flyout control is now based on HeaderedContentControl it would be a simple logic choice to attempt to do this instead of the previous, which was based on ContentControl. Looks like the advantages of this change were the elimination of a couple of dependency properties...

<controls:FlyoutsControl.ItemTemplate>
  <DataTemplate>
    <HeaderedContentControl cal:View.Model="{Binding}" />
  </DataTemplate>
</controls:FlyoutsControl.ItemTemplate>

The other thing that might come out of this that you create a Caliburn.micro convention to actually bind correctly to that HeaderedContentControl which wouldn't be all that different from the ContentControl variant was, by default in CM already. What is odd is that this HeaderedContentControl is derived from ContentControl in theory it should have been found correctly. Another thing to think about is this actually might also be related to Visual Tree where CM can't see it till it's in the tree, therefore can't bind it.

Content Control convention in CM source as a reference.

I've added posted a work around on GitHub.

It appears there's something going on with setting the ItemTemplate of the FlyoutsControl.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!