问题描述
是否可以自动将Caliburn.Micro视图模型绑定到Windows Phone 8 LongListSelector
控件并自动连接SelectedItem属性?
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?
推荐答案
如果我正确理解了您的问题,那么您希望将普通的Caliburn.Micro约定应用于控件。
If i understand your question correctly, then you want normal Caliburn.Micro conventions to be applied to the LongListSelector
control.
我不从事Windows Phone开发,但我认为可以通过在<$中调用以下代码行来完成引导程序的c $ c> Configure()方法。
I don't work with Windows Phone development but i think it can be done by calling the following line of code in the Configure()
method of the bootstrapper.
ConventionManager.AddElementConvention< LongListSelector>(LongListSelector.ItemsSourceProperty , SelectedItem, SelectionChanged);
此代码告诉Caliburn.Micro使用 ItemsSource
属性,只要找到命名的(例如。 x:Name = myList) LongListSelector
,并在每次传递LongListSelector元素时使用 SelectedItem
在操作消息的参数列表中,最后它默认使用 SelectionChanged
事件触发操作消息。
This code tells Caliburn.Micro to use the ItemsSource
property whenever it a finds a named (e.g. x:Name="myList") LongListSelector
and to use the SelectedItem
whenever a LongListSelector element is passed in the parameter list of an action message, and finally it uses the SelectionChanged
event to fire action messages by default.
这篇关于如何将caliburn.micro视图模型绑定到WP8 LongListSelector控件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!