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?
5 Answers, 1 is accepted
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
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
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
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;
}
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