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

PropertyGrid throws exception when nested property of an ExpandoObject is expanded

3 Answers 256 Views
PropertyGrid
This is a migrated thread and some comments may be shown as answers.
Wolfgang
Top achievements
Rank 1
Wolfgang asked on 28 Sep 2016, 09:15 AM

Hi, 

I'm using the RadPropertyGrid to show the properties of ExpandoObject with AutoGeneratePropertyDefinitions=true. The ExpandoObject has two nested properties. The first one is based on a public class with some public properties, the other is a second ExpandoObject. When I run the code the PropertyGrid shows the two nested properties as expected (i.e. they are collapsed).

When I expand the nested properties based on the class by clicking the expand-button (plus-sign in front of the nested propertie's name) the class' properties are shown as expected (see screenshot).

When I click the expand-button to expand the nested properties based on the second ExpandoObject the following exception is thrown:

    An unhandled exception of type 'System.InvalidOperationException' occurred in System.Core.dll

    Additional information: Property path is not valid. 'System.Dynamic.ExpandoObject+MetaExpando' does not have a public property named 'X'.

What can I do to solve this problem? I'm using the latest version "2016.3.194 (Dev)" of UI for WPF. Thank you for your help.

Best regards

Christian

 

P.S. The problem can be reproduced using the following XAML and code

 

<Window x:Class="TelerikWpfApp2.MainWindow"
                xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
                xmlns:propertyGrid="clr-namespace:Telerik.Windows.Controls.Data.PropertyGrid;assembly=Telerik.Windows.Controls.Data"
                Title="RadPropertyGrid with nested properties based on ExpandoObject" Height="350" Width="508.828">
    <StackPanel>
        <telerik:RadPropertyGrid x:Name="MyPropertyGrid" NestedPropertiesVisibility="Visible" />
    </StackPanel>
</Window>

using System;
using System.Windows;
using System.Dynamic;
 
namespace TelerikWpfApp2
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
            FillPropertyGrid();
        }
 
        private void FillPropertyGrid()
        {
 
            dynamic item = new ExpandoObject();
 
            dynamic nestedPropertyBasedOnExpando = new ExpandoObject();
            nestedPropertyBasedOnExpando.X = 1.0;
            nestedPropertyBasedOnExpando.Y = 2.0;
 
            item.NestedPropertyBasedOnClass = new Point(3.0, 4.0);
            item.NestedPropertyBasedOnExpando = nestedPropertyBasedOnExpando;
 
            // if the following propeties are added then no exception is thrown;
            // but nestedProperty1.X and item.X  are bound to each other!
            // item.X = 0.0;
            // item.Y = 0.0;
 
            MyPropertyGrid.Item = item;
             
        }
    }
}


3 Answers, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 03 Oct 2016, 07:31 AM
Hello Wolfgang,

Thank you for the provided code.

I managed to reproduce the issue with it and I am investigating what the cause for it is. I will, however, need a little more time for this. I will write back as soon as I have a result.

Thank you in advance for understanding.

Regards,
Stefan X1
Telerik by Progress
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
0
Ivan Ivanov
Telerik team
answered on 11 Oct 2016, 12:24 PM
Hi,

I can confirm that the reported beahavior is a bug. I am adding 1000 Telerik points to your account in accordance to this report. Here is a public item to our feedbac where you can track our progress with the issue. We will do our best to add a fix for the upcomming SP. 

Regards,
Ivan Ivanov
Telerik by Progress
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
0
Wolfgang
Top achievements
Rank 1
answered on 12 Oct 2016, 11:48 AM

Thank you, Stefan and Ivan, for analyzing the issue and for your feedback. Hope there will be a fix available soon.

Best regards

Christian

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