Custom trackbar editor value changed

6 posts, 0 answers
  1. Valery
    Valery avatar
    53 posts
    Member since:
    May 2011

    Posted 02 Oct 2018 Link to this post

    I override the BaseInputEditor with a trackbar editor (using code from Telerik website).

    But when I change the position of the trackbar, the PropertyValueChanged event does not occur (radPropertyGrid)

    What am I doing wrong?

  2. Dimitar
    Admin
    Dimitar avatar
    2808 posts

    Posted 03 Oct 2018 Link to this post

    Hello Valery,

    I was not able to reproduce the observed behavior on my end. For convenience, I prepared a small sample, based on the information that you provided so far and attached it to this thread. Could you please check it and let me know how it differs from your real setup? 

    I am looking forward to your reply.

    Regards,
    Dimitar
    Progress Telerik
    Get quickly onboard and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
  3. Valery
    Valery avatar
    53 posts
    Member since:
    May 2011

    Posted 03 Oct 2018 in reply to Dimitar Link to this post

    I tried your example: if you move the trackball with the mouse, the event RadPropertyGrid1_PropertyValueChanged does not occur (message "PropertyChanged" is not shown).

    Only when I turn to another item, this event occurs. I need this event to occur as the trackball moves

  4. Dimitar
    Admin
    Dimitar avatar
    2808 posts

    Posted 03 Oct 2018 Link to this post

    Hello Valery,

    The ValueChanged event should be fired changing the value in the editor. However, it does not fire when using a custom editor. This is why I have logged this issue on our Feedback Portal. You can track its progress, subscribe to status changes and add your comment to it here. I have also updated your Telerik Points.

    Here is how to raise the event as a workaround: 
    void TrackBarEditor_ValueChanged(object sender, EventArgs e)
    {
        PropertyGridItemElement owner = this.OwnerElement as PropertyGridItemElement;
     
        if (owner != null)
        {
            var method = owner.PropertyTableElement.GetType().GetMethod("OnValueChanged", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);
            method.Invoke(owner.PropertyTableElement, new object[] { this, EventArgs.Empty });
     
        }
    }

    Should you have any other questions do not hesitate to ask.

    Regards,
    Dimitar
    Progress Telerik
    Get quickly onboard and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
  5. Valery
    Valery avatar
    53 posts
    Member since:
    May 2011

    Posted 03 Oct 2018 in reply to Dimitar Link to this post

    This solution does not work for me.
    I found my workaround:

     

    private void TrackBarEditor_ValueChanged(object sender, EventArgs e)
    {
    if (!(this.OwnerElement is PropertyGridItemElement owner)) return;
    if (!(owner.Data is PropertyGridItem data)) return;
    data.Value = Value;
    }

  6. Dimitar
    Admin
    Dimitar avatar
    2808 posts

    Posted 04 Oct 2018 Link to this post

    Hello Valery,

    This a valid solution and I cannot see a reason not to use it.

    Do not hesitate to contact us if you have other questions.

    Regards,
    Dimitar
    Progress Telerik
    Get quickly onboard and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Back to Top