Bind a Command to a Button inside a ListView with Caliburn.Micro

后端 未结 1 1250
梦毁少年i
梦毁少年i 2020-12-05 11:47

I\'m trying to create something like a MDI tabbed Interface so I have a navigation pane (a Listbox) on the left, and a ContentPresenter on the right.

I have a ShellV

相关标签:
1条回答
  • 2020-12-05 12:23

    Unfortunately, we cannot automatically apply conventions to the contents of DataTemplates. The reason for this is that we have no way of intercepting WPF/Silverlight's template creation mechanism. To get around this you have a couple of options:

    1. Do not use conventions inside of DataTemplates; Use explicit bindings and Message.Attach instead

    2. Extract all DataTemplates into UserControls which will re-enalbe conventions across the UserControl. This is a good idea for large templates, but tedious for small ones

    3. Use the Bind.Model attached property on the root UIElement of the DataTemplate like this Bind.Model="{Binding}". Doing this will cause conventions to be bound against the DataTemplate. Unfortunately, this may not quite work right due to some bugs in Caliburn. It does work in Caliburn.Micro though. I'm hoping to work that bug out soon.

    0 讨论(0)
提交回复
热议问题