Is there a way to automagically bind a Caliburn.Micro view model to the Windows Phone 8 LongListSelector control and auto-wire the SelectedItem property?
1 回答
3
如果我正确理解您的问题,那么您希望将正常的 Caliburn.Micro 约定应用于LongListSelector控件。
我不使用 Windows Phone 开发,但我认为可以通过Configure()在引导程序的方法中调用以下代码行来完成。
ConventionManager.AddElementConvention<LongListSelector>(LongListSelector.ItemsSourceProperty, "SelectedItem", "SelectionChanged");
这段代码告诉 Caliburn.Micro 在ItemsSource找到命名(例如 x:Name="myList") LongListSelector时使用该SelectedItem属性,并在操作消息的参数列表中传递 LongListSelector 元素时使用该属性,最后它使用SelectionChanged默认情况下触发操作消息的事件。
于 2013-07-28T09:05:02.987 回答