DataForm MVVM

3 posts, 0 answers
  1. Rajesh
    Rajesh avatar
    1 posts
    Member since:
    Nov 2011

    Posted 20 Nov 2011 Link to this post

    Hello,
    I go through your documents and online samples, but didn't find any DataForm sample with  MVVM pattern, I m trying to  following code for same, but it not able to add new item and it not synchronising  with grid view. can u provide a sample code for this ? thanks in advance

     

    public ObservableCollection<Employee> SofiaCarRentalDomainContextCollection
    {
        get { return _productionDataCollection; }
        set
        {
            _productionDataCollection = value;
            RaisePropertyChanged("SofiaCarRentalDomainContextCollection");
            EnableCommands();
        }
    }

     

    <telerik:RadGridView x:Name="RadGridView1" ItemsSource="{Binding SofiaCarRentalDomainContextCollection}" MinHeight="100" MaxHeight="500" Width="600" Height="200"
                          CanUserFreezeColumns="False" RowIndicatorVisibility="Collapsed" />
     <telerik:RadDataForm  AutoCommit="True"
         Width="600" x:Name="myRadDataForm" ItemsSource="{Binding SofiaCarRentalDomainContextCollection}" Header="Employee Details" Grid.Row="1" AutoGeneratingField="myRadDataForm_AutoGeneratingField">
         <i:Interaction.Triggers>
             <i:EventTrigger EventName="AddedNewItem">
                 <E2C:EventToCommand  Command="{Binding AddNewCommand}" PassEventArgsToCommand="True"></E2C:EventToCommand>
             </i:EventTrigger>
             <i:EventTrigger EventName="EditEnded">
                 <E2C:EventToCommand  Command="{Binding SaveCommand}" PassEventArgsToCommand="True"></E2C:EventToCommand>
             </i:EventTrigger>
         </i:Interaction.Triggers>
     </telerik:RadDataForm>

  2. Chetan
    Chetan avatar
    26 posts
    Member since:
    Oct 2012

    Posted 19 Dec 2012 Link to this post


    I am also having same problem with 2012 Q3 sp1 release.
    Do not know steps to invoke EndEdit event in MVVM ICOMMAND

    <telerik:RadGridView x:Name="radGridview"
                                ItemsSource="{Binding AllItems}" SelectedItem="{Binding SelectedItem,Mode=TwoWay}" Grid.Row="0" 
                                  AutoGenerateColumns="True"    
                                IsReadOnly="True" HorizontalContentAlignment="Stretch" 
                                >
               <telerik:RadGridView.Columns>
                   <telerik:GridViewToggleRowDetailsColumn>
                   </telerik:GridViewToggleRowDetailsColumn>
               </telerik:RadGridView.Columns>
               <telerik:RadGridView.RowDetailsTemplate>
                   <DataTemplate>
                       <telerik:RadDataForm Grid.Row="0"
                                Name="clubsForm" CurrentItem="{Binding}" Margin="5">
                           <i:Interaction.Triggers>
                               <i:EventTrigger EventName="EditEnded" >
                                   <i:InvokeCommandAction Command="{Binding EditEndedCommand}"  CommandParameter="{Binding ElementName=clubsForm, Path=CurrentItem}" />
                               </i:EventTrigger>
                           </i:Interaction.Triggers>
                       </telerik:RadDataForm>
                   </DataTemplate>
               </telerik:RadGridView.RowDetailsTemplate>
           </telerik:RadGridView>

    Here EditEndedCommand is not hit in view model

    Private _ic1 As ICommand
       Public ReadOnly Property EditEndedCommand As ICommand  ' System.Windows.Input.ICommand
           Get
               If _ic1 Is Nothing Then
                   _ic1 = New RelayCommand(AddressOf EditEnded_Click)
               End If
               Return _ic1
           End Get
       End Property

    please suggest..
  3. DevCraft banner
  4. Ivan Ivanov
    Admin
    Ivan Ivanov avatar
    1127 posts

    Posted 21 Dec 2012 Link to this post

    Hello,

    Can you please check whether you have any BIndingExpressionPath errors in your Output at runtime. In case the issue persists, I would kindly ask you to send us a repro project that we would be able to debug on our side and locate the issue.

    All the best,
    Ivan Ivanov
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Back to Top