Need a Help on Binding using caliburn

Aug 21, 2010 at 6:30 PM

Hi,

Im newbie in Caliburn Micro, Im using it for my silverlight 4 application. Here is the requirement im having, Im developing an survey kind of application. For Question, it has different Answers i.e all valid answers for particular question will be displayed in Radio Button or Drop Down or Check Box.  I Considered Question is a Domain Object (Model), In the Question, I have an Enum, which will tell me either to display Answers in combo box format or Answers to be displayed in Check boxes or radio button.

In WPF , I might have use Template Selector, but in sivler light we dont have TemplateSelector, How to Solve this problem in Caliburn.

I Heard tht using caliburn, I can solve above kind scenarios, can any1 provide me solutions.

Not only that , I heard that in order to fix above problem, We need to Create Mutliple Views and ViewModels for each Question like For Each Question, If the type of Answer to display is "ComboBox", Then we create usercontrol which holds combobox and this combox is bounded to corresponding question's Answer values .Simliarly, If we need to display answers in "Radio button" format, then we need to create Usercontrol which holds RadionButton List and BInd to Collection of Answers for particular Question..

Is there any other simple approach to solve above problem

 

WIth Regards,

Mahens

Coordinator
Aug 21, 2010 at 6:39 PM

There is an extensibility point you want to look into for your scenario. Have a look at the ViewLocator. You could customize the GetViewForModel to inspect the incoming class, check its Enum value and return the appropriate View.