How to bind caliburn.micro view model to WP8 LongListSelector control?

我们两清 提交于 2019-12-08 08:19:48

问题


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:


If i understand your question correctly, then you want normal Caliburn.Micro conventions to be applied to the LongListSelector control.

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");

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.



来源:https://stackoverflow.com/questions/17905342/how-to-bind-caliburn-micro-view-model-to-wp8-longlistselector-control

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