PropertyGrid Custom TypeEditor INotifyPropertyChanged

2 posts, 0 answers
  1. Andrea
    Andrea avatar
    1 posts
    Member since:
    Nov 2013

    Posted 14 Jul 2014 Link to this post


    several properties of the object attached to my RadPropertyGrid are of a custom type "DPDouble", which wraps some functionality around a double value.
    In order to show and edit properties of this type in the Grid, I have implemented a custom type editor DPDoubleEditorNew which is called like this:

    01.void RequestEditors(object sender, Telerik.WinControls.UI.PropertyGridEditorRequiredEventArgs e)
    03.    PropertyGridItem item = e.Item as PropertyGridItem;
    04.    if (item.PropertyType == typeof(DPDouble))
    05.    {
    06.        e.EditorType = typeof(DPDoubleEditorNew);
    07.    }

    And the editor is based on this code:

       public class DPDoubleEditorNew : BaseTextBoxEditor
        private DPDouble internalvalue;
        public override object Value
                BaseTextBoxEditorElement element = this.EditorElement as BaseTextBoxEditorElement;
                double myval;
                if(double.TryParse(element.Text,out myval))
                return internalvalue;
                internalvalue = (DPDouble)value;
                base.Value = internalvalue;

    Basically you see that I keep a pointer to the DPDouble object and when the editor is done I use the SetValueAuto as setter function.
    This works fine, but although the bound object subscribes to INotifyPropertyChanged interface, and I raise the PropertyChanged event in the SetValueAuto setter function, my grid seems unable to catch the event.

    My object has the following event

    public event PropertyChangedEventHandler PropertyChanged;
        public void RaisePropertyChanged(String info)
            if (PropertyChanged != null)
                PropertyChangedEventArgs args = new PropertyChangedEventArgs(info);
                PropertyChanged(this, args);

    The RaisePropertyChanged gets called, but although my grid subscribes to the PropertyChanged event 

    PropertyGrid.PropertyChanged += new PropertyChangedEventHandler(PropertyGrid_PropertyChanged);

    the handler is never called.
    It seems like the INotifyPropertyChanged is notifying somebody else than my grid.

    Do you have any suggestions?
  2. Yoan
    Yoan avatar
    1051 posts

    Posted 17 Jul 2014 Link to this post

    Hi Andrea,

    Our RadPropertyGrid does not have its own PropertyChanged event. This is why I am not sure that I can understand your question. May I ask you to provide a sample project illustrating your scenario. This will helps us to assist you better.
    I'm looking forward to hearing from you.

    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
  3. DevCraft R3 2016 release webinar banner
Back to Top