Dec 20, 2011 at 1:15 PM
Edited Dec 20, 2011 at 1:46 PM
Since i find the whole auto convention thing pretty useful but am doing this through code(will not get into why..)
i was wondering if something like this is possible in XAML:
View is automatically binded to the ViewModel...and any button click is nicelly mapped to the CanClick property and Click Method by Caliburn Micro.
THIS PART WORKS GREAT!
Not let's suppose that this View contains another grid...which contains more buttons.
And let's say i want to do the same magic binding for all these buttons...but i don't want the actions to be binded to the Can_MethodName and MethodName methods on the current ViewModel...but rather an instance property on the ViewModel.
So we have
MainPageView which caliburn micro has "magically" binded to MainPageViewModel.
MainPageView contains a Grid with 5 Buttons.I want those clicks to be binded to MainPageViewModel.ButtonActions
ButtonActions is an instance of a class which has the required methods who's names match the buttons name.
Can i use the caliburn:View...and other attached properties in XAML to somehow make this work?
i'm guessing there's a dependency property in caliburn micro which can be used to do the following:
ViewModelBinder.Bind(viewModel, view, null);
Where view is the FrameworkElement and well...i provide the viewModel with binding :)