PropertyGrid throws exception when nested property of an ExpandoObject is expanded

4 posts, 0 answers
  1. Wolfgang
    Wolfgang avatar
    2 posts
    Member since:
    Sep 2013

    Posted 28 Sep Link to this post

    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;
                 
            }
        }
    }


  2. Stefan X1
    Admin
    Stefan X1 avatar
    523 posts

    Posted 03 Oct Link to this post

    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.
  3. UI for WPF is Visual Studio 2017 Ready
  4. Ivan Ivanov
    Admin
    Ivan Ivanov avatar
    1128 posts

    Posted 11 Oct Link to this post

    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.
  5. Wolfgang
    Wolfgang avatar
    2 posts
    Member since:
    Sep 2013

    Posted 12 Oct Link to this post

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

    Best regards

    Christian

Back to Top