Gridview and to set it on edit mode?

Topics: Conventions, UI Architecture
May 23, 2012 at 3:58 PM


I've got a silverlight 5 application with a telerik RadGridView as master and a RaDataForm for showing the detail... I've also a button that should set the dataform in edit mode...


In an exmple I've seen it uses


<telerik:RadButton RenderTransformOrigin="0.5,0.5" Style="{StaticResource HeaderCircleButtonStyle}" Margin="0,0,40,0" Tag="ADD"
                               Command="telerik:RadDataFormCommands.AddNew" CommandTarget="{Binding ElementName=dataForm}">
                    <CompositeTransform TranslateY="-21"/>
                <Path Stretch="Fill" Fill="{StaticResource MainBrush}"
                      Data="F1 M 22,12L 26,12L 26,22L 36,22L 36,26L 26,26L 26,36L 22,36L 22,26L 12,26L 12,22L 22,22L 22,12 Z " 
                      Height="24" Width="24"/>

and the dataform is


<telerik:RadDataForm x:Name="dataForm"
							 ItemsSource="{Binding Contacts}" 
                             ReadOnlyTemplate="{StaticResource contactsReadOnlyTemplate}"
                             EditTemplate="{StaticResource contactsEditTemplate}"
                             NewItemTemplate="{StaticResource contactsEditTemplate}" 
                             VerticalContentAlignment="Stretch" HorizontalContentAlignment="Stretch"/>

In a caliburn micro way how do I tell the viewmodel to set the dataform in edit?

I can't use this :

 Command="telerik:RadDataFormCommands.AddNew" CommandTarget="{Binding ElementName=dataForm}"

May 23, 2012 at 7:03 PM
Edited May 23, 2012 at 7:04 PM

wouldn't this be one of those instances where you want to use the code behind of the view to tell the control to "switch" modes?  Since looking at the available properties and methods for that control you can't set the mode from the viewmodel with a binding, the Mode property is getter only it appears.  Just a thought..