This is a migrated thread and some comments may be shown as answers.

Problem with 2012 Q3 SP1

4 Answers 71 Views
DataForm
This is a migrated thread and some comments may be shown as answers.
Stefan Bischof
Top achievements
Rank 1
Stefan Bischof asked on 05 Dec 2012, 12:46 PM
Hi,
with latest control I get this Error:
Function: InvokeArgumentsCheck(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) 

Class: System.Reflection.RuntimeMethodInfo

Stacktrace: 
 bei System.Reflection.RuntimeMethodInfo.InvokeArgumentsCheck(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   bei System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   bei System.Reflection.RuntimePropertyInfo.GetValue(Object obj, Object[] index)
   bei Telerik.Windows.Data.ItemPropertyInfoExtensions.GetValue(ItemPropertyInfo itemProperty, Object item)
   bei Telerik.Windows.Controls.RadDataForm.PopulatePropertiesInitialValues(Object currentItem)
   bei Telerik.Windows.Controls.RadDataForm.OnCurrentItemChanged(DependencyObject sender, DependencyPropertyChangedEventArgs args)
   bei System.Windows.DependencyObject.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
   bei System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
   bei System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args)
   bei System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType)
   bei System.Windows.DependencyObject.InvalidateProperty(DependencyProperty dp, Boolean preserveCurrentValue)
   bei System.Windows.Data.BindingExpressionBase.Invalidate(Boolean isASubPropertyChange)
   bei System.Windows.Data.BindingExpression.TransferValue(Object newValue, Boolean isASubPropertyChange)
   bei System.Windows.Data.BindingExpression.Activate(Object item)
   bei System.Windows.Data.BindingExpression.AttachToContext(AttachAttempt attempt)
   bei System.Windows.Data.BindingExpression.MS.Internal.Data.IDataBindEngineClient.AttachToContext(Boolean lastChance)
   bei MS.Internal.Data.DataBindEngine.Task.Run(Boolean lastChance)
   bei MS.Internal.Data.DataBindEngine.Run(Object arg)
   bei MS.Internal.Data.DataBindEngine.OnLayoutUpdated(Object sender, EventArgs e)
   bei System.Windows.ContextLayoutManager.fireLayoutUpdateEvent()
   bei System.Windows.ContextLayoutManager.UpdateLayout()
   bei System.Windows.ContextLayoutManager.UpdateLayoutCallback(Object arg)
   bei System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks()
   bei System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget)
   bei System.Windows.Media.MediaContext.RenderMessageHandler(Object resizedCompositionTarget)
   bei System.Windows.Interop.HwndTarget.OnResize()
   bei System.Windows.Interop.HwndTarget.HandleMessage(WindowMessage msg, IntPtr wparam, IntPtr lparam)
   bei System.Windows.Interop.HwndSource.HwndTargetFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   bei MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   bei MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
   bei System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   bei MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)

4 Answers, 1 is accepted

Sort by
0
Ivan Ivanov
Telerik team
answered on 10 Dec 2012, 02:57 PM
Hi,

Can you please shed some more light on this? Would you please list the sequence of operations that you have executed or send a repro project?

Greetings,
Ivan Ivanov
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Stefan Bischof
Top achievements
Rank 1
answered on 11 Dec 2012, 08:05 AM
/// <summary>
   /// Interaction logic for CustomRadDataForm.xaml
   /// </summary>
   public partial class CustomRadDataForm : RadDataForm
   {
       public static readonly DependencyProperty IsInEditModeProperty = DependencyProperty.Register("IsInEditMode", typeof(bool), typeof(CustomRadDataForm), new FrameworkPropertyMetadata(false, OnIsInEditModePropertyChanged));
 
     
       public bool IsInEditMode
       {
           get { return (bool)GetValue(IsInEditModeProperty); }
           set { SetValue(IsInEditModeProperty, value); }
       }
 
       public CustomRadDataForm()
       {
           this.InitializeComponent();
       }
 
      
       private static void OnIsInEditModePropertyChanged(DependencyObject source, DependencyPropertyChangedEventArgs e)
       {
           if(!(e.NewValue is bool)) return;
           if (e.NewValue.ToBoolean() == true)
           {
               source.As<CustomRadDataForm>().BeginEdit();
           }
           else if (e.NewValue.ToBoolean() == false)
           {
               source.As<CustomRadDataForm>().OnItemEditEnded(new EditEndedEventArgs(EditAction.Cancel));
           }
       }
<telerik:RadDataForm
     xmlns:my="clr-namespace:xxx.Controls"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
             xmlns:converters="clr-namespace:xxx.Converters"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:DataForm="clr-namespace:Telerik.Windows.Controls.Data.DataForm;assembly=Telerik.Windows.Controls.Data" x:Class="TrustedData.Controls.CustomRadDataForm"
             mc:Ignorable="d"
             d:DesignHeight="300" d:DesignWidth="300" Template="{DynamicResource CustomRadDataFormControlTemplate}">
 
    <telerik:RadDataForm.Resources>
        <converters:ImageConverter x:Key="imageConverter"/>
 
        <ControlTemplate x:Key="CustomRadDataFormControlTemplate" TargetType="{x:Type telerik:RadDataForm}">
            <Border x:Name="PART_RootElement" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}">
                <Grid x:Name="PART_DataFormGrid" Background="{TemplateBinding Background}" Style="{DynamicResource CustomRadDataFormStyle}">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="*"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                    </Grid.RowDefinitions>
                    <Border x:Name="Header" BorderBrush="#FF282828" BorderThickness="1" Margin="-1,-1,-1,0">
                        <Border.Visibility>
                            <Binding Path="Header" RelativeSource="{RelativeSource TemplatedParent}">
                                <Binding.Converter>
                                    <DataForm:DescriptionVisibilityConverter/>
                                </Binding.Converter>
                            </Binding>
                        </Border.Visibility>
                        <Border BorderBrush="#FFB5B5B5" BorderThickness="1">
                            <Border.Background>
                                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                    <GradientStop Color="#FF5B5B5B" Offset="1"/>
                                    <GradientStop Color="#FF868686"/>
                                    <GradientStop Color="#FF4F4F4F" Offset="0.42"/>
                                    <GradientStop Color="#FF0E0E0E" Offset="0.43"/>
                                </LinearGradientBrush>
                            </Border.Background>
                            <ContentControl x:Name="PART_ContentPresenter" Content="{TemplateBinding Header}" Foreground="White" FontWeight="Bold" HorizontalContentAlignment="Stretch" Margin="4,6" VerticalAlignment="Center" VerticalContentAlignment="Top"/>
                        </Border>
                    </Border>
                    <Border BorderBrush="#FF848484" BorderThickness="0,0,0,1" Grid.Row="2">
                        <ScrollViewer x:Name="PART_ItemsScrollViewer" HorizontalScrollBarVisibility="Auto" IsTabStop="False" VerticalScrollBarVisibility="Auto">
                            <telerik:StyleManager.Theme>
                                    <telerik:MetroTheme/>
                                </telerik:StyleManager.Theme>
                            <StackPanel Orientation="Vertical">
                                <DataForm:AutoGeneratedFieldsPresenter x:Name="PART_AutoGeneratedFieldsPresenter" AutoGenerateFields="{Binding AutoGenerateFields, RelativeSource={RelativeSource TemplatedParent}}">
                                    <telerik:StyleManager.Theme>
                                    <telerik:MetroTheme/>
                                </telerik:StyleManager.Theme>
                                </DataForm:AutoGeneratedFieldsPresenter>
                                <ContentPresenter x:Name="PART_FieldsContentPresenter"/>
                            </StackPanel>
                        </ScrollViewer>
                    </Border>
                    <DataForm:DataFormValidationSummary x:Name="PART_ValidationSummary" Margin="0,0,0,-1" Grid.Row="3" Visibility="{TemplateBinding ValidationSummaryVisibility}">
                        <telerik:StyleManager.Theme>
                                    <telerik:MetroTheme/>
                                </telerik:StyleManager.Theme>
                    </DataForm:DataFormValidationSummary>
                    <Border x:Name="Background_Disabled" IsHitTestVisible="False" Grid.RowSpan="5">
                        <Border.Background>
                            <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                <GradientStop Color="#7F000000"/>
                                <GradientStop Color="#7F000000" Offset="1"/>
                                <GradientStop Color="#33000000" Offset="0.5"/>
                            </LinearGradientBrush>
                        </Border.Background>
                        <Border.Visibility>
                            <Binding Path="IsEnabled" RelativeSource="{RelativeSource TemplatedParent}">
                                <Binding.Converter>
                                    <telerik:InvertedBooleanToVisibilityConverter/>
                                </Binding.Converter>
                            </Binding>
                        </Border.Visibility>
                    </Border>
                </Grid>
            </Border>
        </ControlTemplate>
    </telerik:RadDataForm.Resources>
</telerik:RadDataForm>
<my:CustomRadDataForm:Name="dataForm"  IsInEditMode="{Binding IsInEditMode,UpdateSourceTrigger=PropertyChanged}"
                                         AutoGenerateFields="False" ScrollViewer.HorizontalScrollBarVisibility="Auto"
                                         ItemsSource="{Binding Categories, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                                         CurrentItem="{Binding SelectedItem, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" NewItemTemplate="{StaticResource dataFormEditAndNewTemplate}"
                                         EditTemplate="{StaticResource dataFormEditAndNewTemplate}"  ReadOnlyTemplate="{StaticResource dataFormReadOnlyTemplate}"/>
0
Stefan Bischof
Top achievements
Rank 1
answered on 11 Dec 2012, 08:07 AM
As I sad it works with previous version of controls just fine.
0
Ivan Ivanov
Telerik team
answered on 12 Dec 2012, 11:29 AM
Hi,

I have tried to reproduced the issue on my side, but unfortunately, without any success. Can you please inspect my test project and share whether I am missing something. You can also update it if it is needed and send it back to us via the support ticket that you have opened. I have noticed that the method PopulatePropertiesInitialValues where the exception seems to occur is related to an internal caching mechanism of RadDataForm, so that the issue may prove to be data-related. Would it be possible for you to isolate it in a project that uses your BusinessObject and send it back to us?

Regards,
Ivan Ivanov
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
DataForm
Asked by
Stefan Bischof
Top achievements
Rank 1
Answers by
Ivan Ivanov
Telerik team
Stefan Bischof
Top achievements
Rank 1
Share this question
or