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?
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