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

AutoBindBehavior crash with custom PropertyDefinitions and non-default PropertySetMode

3 Answers 20 Views
PropertyGrid
This is a migrated thread and some comments may be shown as answers.
Guy
Top achievements
Rank 1
Guy asked on 23 Jun 2016, 10:32 PM

It looks like the AutoBindBehavior doesn't handle the case where custom PropertyDefinitions are used, a PropertySetMode of Union or Intersection is used and an IEnumerable is assigned to the PropertyGrid.Item. This results in a Linq exception: Sequence contains no elements with the following callstack:

   at System.Linq.Enumerable.First[TSource](IEnumerable`1 source)
   at Telerik.Windows.Controls.Data.PropertyGrid.AutoBindBehavior.BindEditor(FrameworkElement editorElement, DependencyProperty property)
   at Telerik.Windows.Controls.Data.PropertyGrid.AutoBindBehavior.<>c__DisplayClass4.<OnUpdateBindingOnElementLoaded>b__0(Object s, RoutedEventArgs args)
   at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
   at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
   at System.Windows.BroadcastEventHelper.BroadcastEvent(DependencyObject root, RoutedEvent routedEvent)
   at System.Windows.BroadcastEventHelper.BroadcastLoadedEvent(Object root)
   at MS.Internal.LoadedOrUnloadedOperation.DoWork()
   at System.Windows.Media.MediaContext.FireLoadedPendingCallbacks()

3 Answers, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 24 Jun 2016, 02:56 PM
Hi Guy,

I tried to reproduce such exception with the described setup, but to no avail. Can you please check out the sample application attached to my post and let me know in case I am missing something?

Regards,
Stefan X1
Telerik
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
0
Guy
Top achievements
Rank 1
answered on 24 Jun 2016, 09:14 PM

Thanks for the sample Stephan, I've tweaked it to be able to reproduce the crash.

The property grid doesn't correctly show the country initially and clicking the "change item" button will produce the crash. How should I send it to you?

0
Stefan
Telerik team
answered on 29 Jun 2016, 11:52 AM
Hello Guy,

Our system does not allow attachments in forum threads, but in support tickets only. You can, however, share how the project which I attached in my previous reply differs from your setup, so I can try finding a possible cause for this issue.

Regards,
Stefan X1
Telerik
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
Tags
PropertyGrid
Asked by
Guy
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Guy
Top achievements
Rank 1
Share this question
or