or
Hi,
I'm looking for an example of using RadDataForm to Update and/or Insert data in a SQL Server table in a WPF MVVM Light application.
I've binding DataForm with a LIST that contains a result of a sql query but I've not idea how to update or inser a value.
Thank's a lot!
<telerik:RadDocking Grid.Column="1" x:Name="radDocking1" Grid.Row="1" Margin="0 0 0 10" BorderThickness="0" Visibility="{Binding Hidden,ConverterParameter=True, Mode=TwoWay, Converter={StaticResouce CvtVisibilityConverter}}" Padding="0" > <telerik:RadSplitContainer InitialPosition="FloatingOnly" telerik:RadDocking.FloatingLocation="450, 250" > <telerik:RadPaneGroup > <telerik:RadPane Title="My Pane" CanDockInDocumentHost="False" CanUserClose="False" CanUserPin="False" > </telerik:RadPane> </telerik:RadPaneGroup> </telerik:RadSplitContainer> </telerik:RadDocking>public class MyViewModel: ViewModelBase{public MyViewModel{ Hidden = true ;} public bool Hidden { get { return hidden; } set { hidden = value; OnPropertyChanged("Hidden"); } } private ICommand showCommand; private ICommand closeCommand; public ICommand CloseCommand { get { if (closeCommand == null) closeCommand = new RelayCommand(param => this.CloseCommandEvent()); return closeCommand; } } private void CloseCommandEvent() { Hidden = true; } public ICommand showCommand { get { if (showCommand == null) showCommand = new RelayCommand(param => this.ShowCommandEvent()); return showCommand; } } private void ShowCommandEvent() { Hidden = false; }}public class VisibilityConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { if (value == null || !(value is Boolean)) return Visibility.Collapsed; var parm = parameter ?? false; bool flip; Boolean.TryParse(parm.ToString(), out flip); var visible = flip ? !((bool)value) : (bool)value; return visible ? Visibility.Visible : Visibility.Collapsed; } public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { throw new NotImplementedException(); } }private void HandleKeyDown(KeyEventArgs e)
{
if (e.Key == Key.Down)
{
RadGridViewCommands.MoveDown.Execute(null);
RadGridViewCommands.SelectCurrentUnit.Execute(null);
RadGridViewCommands.BeginEdit.Execute(null);
e.Handled = true;
}
}