RadPropertyGrid custom dropdown editor not changing

6 posts, 0 answers
  1. Michael
    Michael avatar
    14 posts
    Member since:
    Jun 2012

    Posted 27 Jul 2012 Link to this post

    Hello,

    I've got a custom editor for some PropertyGrid items that is displaying in the grid values correctly, and the subsequent drop down list is appearing correctly, however, when I select a new value, the PropertyStoreItem PropertyChanged event is not firing.

    I'm using your RadPropertyGridEditorExample as a template to get started. My data source is IEnumerable<> and not List<>. That's one difference. Other than that, what insights are there what I might be missing?

    Edit: I'm also using a Guid for the SelectedValue and not a more primitive type like Int32 (as per the example). Basically, otherwise, I've got the same sort of thing going on, a complex user object not unlike Digit that wraps my Domain Object and exposes value and display name sufficient to facilitate the drop down.

    Thank you...
  2. Michael
    Michael avatar
    14 posts
    Member since:
    Jun 2012

    Posted 27 Jul 2012 Link to this post

    Did a little more digging through the forums. I think I found a plausible workaround through this issue in this post: propertychange-event.
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Michael
    Michael avatar
    14 posts
    Member since:
    Jun 2012

    Posted 27 Jul 2012 Link to this post

    OKAY! Found the answer.

    In the code of our EditorInitialized event handler:

    var __e_Editor_EditorElement = e.Editor.EditorElement;
    __e_Editor_EditorElement.SelectedValue = ((PropertyGridItem) e.Item).Value;

    Something like the Digit project example: SelectedValue.GetType() and PropertyGridItem.Value.GetType() were both Int32.

    Our example was a little bit different in that the object backing the PropertyStoreItem itself was the complex object and not a primitive. So we ended up with something like typeof(Guid) != typeof(OurObject).

    When I exposed a reference to the complex object this reference, this all cleared up and I got the PropertyChanged event from the PropertyStoreItem like I expect.

    Hope this helps someone.



  5. Ivan Petrov
    Admin
    Ivan Petrov avatar
    701 posts

    Posted 01 Aug 2012 Link to this post

    Hi Michael,

    Thank you for writing.

    There is a Type check when assigning a value to a PropertyStoreItem. The check ensures that the value coming from the editor can be assigned or converted to the type of the PropertyStoreItem. This is why the event was not firing.

    I am glad you have found an answer to your question. If you have further questions, do not hesitate to write back.

    Kind regards,
    Ivan Petrov
    the Telerik team
    RadControls for WinForms Q2'12 release is now live! Check out what's new or download a free trial >>
  6. Ivajlo
    Ivajlo avatar
    1 posts
    Member since:
    Oct 2012

    Posted 28 Nov 2012 Link to this post

    Do you know somebody how can I use
    PropertyStoreItem engineFuel = new PropertyStoreItem(typeof(Fuels), "Fuel", Fuels.Petrol,
                    "The type of fuel providing the energy source for the engine.", "Engine");
    but instead enum type to be List<ClassName>

    Thanks

  7. Ivan Petrov
    Admin
    Ivan Petrov avatar
    701 posts

    Posted 03 Dec 2012 Link to this post

    Hello Ivajlo,

    Thank you for writing.

    Properties of type List<SomeClass> are edited in the property grid using the standard .NET collection editor. However if you would like to edit the list using a finite amount of predefined values you can take a look at the attached project. It uses the editor created in the following article with a few tweaks to make it work in the property grid. It allows users to use a drop down list editor and select multiple items, which are then added to the list.

    I hope this will be useful. Should you have further questions, I would be glad to help.
     
    Kind regards,
    Ivan Petrov
    the Telerik team
    Q3’12 of RadControls for WinForms is available for download (see what's new). Get it today.
Back to Top
UI for WinForms is Visual Studio 2017 Ready