Problems syncing form and grid

3 posts, 0 answers
  1. Rayne
    Rayne avatar
    241 posts
    Member since:
    Sep 2010

    Posted 04 Apr 2012 Link to this post

    I can't seem to get the DataForm to sync with the GridView.

    I've got both controls bound via ItemsSource to the same collection in my viewmodel. But when the form loads in debug, there doesn't appear to be any records. If I create a header for the DataForm that displays Items.Count, it correctly shows the number of Items in the collection. But the current item isn't working. When I click on a Navigation button or the new button, I get the following error:

    System.Reflection.TargetParameterCountException occurred
      Message=Parameter count mismatch.
      Source=mscorlib
      StackTrace:
           at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
           at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
           at System.Reflection.RuntimePropertyInfo.GetValue(Object obj, BindingFlags invokeAttr, Binder binder, Object[] index, CultureInfo culture)
           at System.Reflection.RuntimePropertyInfo.GetValue(Object obj, Object[] index)
           at Telerik.Windows.Data.ItemPropertyInfoExtensions.GetValue(ItemPropertyInfo itemProperty, Object item) in c:\TB\105\WPF_Scrum\Release_WPF\Sources\Development\Core\Data\ItemProperties\ItemPropertyInfoExtensions.cs:line 101

    Call Stack:
     > Telerik.Windows.Data.dll!Telerik.Windows.Data.ItemPropertyInfoExtensions.GetValue(System.ComponentModel.ItemPropertyInfo itemProperty, object item) Line 101 C#
      Telerik.Windows.Controls.Data.dll!Telerik.Windows.Controls.RadDataForm.PopulatePropertiesInitialValues(object currentItem) Line 886 C#
      Telerik.Windows.Controls.Data.dll!Telerik.Windows.Controls.RadDataForm.OnCurrentItemChanged(System.Windows.DependencyObject sender, System.Windows.DependencyPropertyChangedEventArgs args) Line 854 C#
      [External Code]
      Telerik.Windows.Controls.Data.dll!Telerik.Windows.Controls.RadDataForm.CurrentItem.set(object value) Line 829 C#
      Telerik.Windows.Controls.Data.dll!Telerik.Windows.Controls.RadDataForm.OnItemsCurrentChanged(object sender, System.EventArgs e) Line 791 C#
      Telerik.Windows.Data.dll!Telerik.Windows.Data.DataItemCollection.OnCurrentChanged(System.EventArgs e) Line 489 C#
      Telerik.Windows.Data.dll!Telerik.Windows.Data.DataItemCollection.OnCollectionViewCurrentChanged(object sender, System.EventArgs args) Line 557 C#
      Telerik.Windows.Data.dll!Telerik.Windows.Data.Listener<System.ComponentModel.ICollectionView,System.EventArgs>.ReceiveWeakEvent(object sender, System.EventArgs args) Line 43 C#
      Telerik.Windows.Data.dll!Telerik.Windows.Data.WeakEvent.WeakListener<System.EventArgs>.Handler(object sender, System.EventArgs args) Line 33 C#
      Telerik.Windows.Data.dll!Telerik.Windows.Data.QueryableCollectionView.OnCurrentChanged(System.EventArgs args) Line 141 C#
      Telerik.Windows.Data.dll!Telerik.Windows.Data.QueryableCollectionView.MoveCurrentToPositionCore(int position) Line 110 C#
      Telerik.Windows.Data.dll!Telerik.Windows.Data.QueryableCollectionView.MoveCurrentToPosition(int position) Line 97 C#
      Telerik.Windows.Data.dll!Telerik.Windows.Data.QueryableCollectionView.MoveCurrentTo(object item) Line 46 C#
      Telerik.Windows.Data.dll!Telerik.Windows.Data.QueryableCollectionView.AddNewInternal(object newItem) Line 462 C#
      Telerik.Windows.Data.dll!Telerik.Windows.Data.QueryableCollectionView.AddNew(object newItem) Line 281 C#
      Telerik.Windows.Data.dll!Telerik.Windows.Data.QueryableCollectionView.AddNew() Line 248 C#
      Telerik.Windows.Data.dll!Telerik.Windows.Data.DataItemCollection.AddNew() Line 82 C#
      Telerik.Windows.Controls.Data.dll!Telerik.Windows.Controls.RadDataForm.AddNewItem() Line 1715 C#
      Telerik.Windows.Controls.Data.dll!Telerik.Windows.Controls.RadDataForm.OnAddNew(object sender, System.Windows.Input.ExecutedRoutedEventArgs e) Line 108 C#
      [External Code]
      Telerik.Windows.Controls.dll!Telerik.Windows.Controls.RadButton.OnClick() Line 388 C#
      [External Code]


    Please help. I get the same error when I set the DataForm in the RowDetailsTemplate for the grid. in this situation it is triggered when I click on an item in the grid to select it and it tries to show the row details.
  2. Rayne
    Rayne avatar
    241 posts
    Member since:
    Sep 2010

    Posted 04 Apr 2012 Link to this post

    Upgrading to the latest internal build seemed to fix the problem.
  3. UI for WPF is Visual Studio 2017 Ready
  4. Jeff
    Jeff avatar
    64 posts
    Member since:
    Dec 2011

    Posted 19 Apr 2012 Link to this post

    I'm working in a fairly complicated application, that has a number of controls that bind to instances of a database record wrapper class.

    I added a do-nothing IDataErrorInfo implementation to the base class of the record wrappers (that returned no errors, regardless), and suddenly this error occurred.  If I removed IDataErrorInfo, the error went away.

    Updating to 2012.1.0416.40 fixed the problem.
Back to Top