Hi Guys!
I am fairly new into Telerik business, so please apologize if this isnt the way to report a possible bug.
My recent project is a simulation software for thermal power plants. In a canvas the user can drag&drop
various powergrid objects and connect them to each other.
The user can enter math formulas using public properties of any object on the canvas. And here comes
radExpressionEditor into the game. In this project I am using ILGenerator to dynamicaly add Properties
at runtime. Unfortunately radExpressionEditor doesnt support multiple Item objects.
So much for a little background info. Now for the bug.....
I have a object with the following signature:
public class DynamicFields : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
private int _Test;
public int Test
{
get { return _Test; }
set { _Test = value; PropertyChangedHandler("Test"); }
}
public DynamicFields() { }
public void PropertyChangedHandler(string propertyName)
{
PropertyChangedEventHandler handler = PropertyChanged;
if (handler != null)
{
handler(this, new PropertyChangedEventArgs(propertyName));
}
}
// BUG: RadExpressionEditor sets a Handle on this.PropertyChanged, but doesnt have any Targetdelegate.
// Lets remove it here as a workaround!
public void RemoveLastPropertyChangedHandler()
{
Delegate RemoveDelegate = this.PropertyChanged.GetInvocationList().Last();
if (RemoveDelegate != null)
{
this.PropertyChanged -= (RemoveDelegate as PropertyChangedEventHandler);
}
}
Some other place in my code I do something like this:
//Window with ExpressionEditor that will be shown as a dialog
Window_ExpressionEditor ee = new Window_ExpressionEditor();
//FormelEditor is an instance of ExpressionEditor
ee.FormelEditor.Item = Device.dynamicFields;
//As soon the Item Property is set to my Dynamicobject, radExpressionEditor will subscribe to
//the PropertyChanged event but without any target method to call.
//So then ever I change the Value of a property the PropertyChangedHandler raises an exception.
//Workaround is to delete last entry of the GetInvocationList()
DynamicFields df = this.Device.dynamicFields;
df.RemoveLastPropertyChangedHandler();
This behaviour also occurs if I use a "normal" class without expanding the properties at runtime.
Right now my workaround runs fine, but would be nice to get this bug verified.
Oh and please implement radExpressionEditor.Items for multiple objects use ;-)
Thank you and my best regards, Martin
I am fairly new into Telerik business, so please apologize if this isnt the way to report a possible bug.
My recent project is a simulation software for thermal power plants. In a canvas the user can drag&drop
various powergrid objects and connect them to each other.
The user can enter math formulas using public properties of any object on the canvas. And here comes
radExpressionEditor into the game. In this project I am using ILGenerator to dynamicaly add Properties
at runtime. Unfortunately radExpressionEditor doesnt support multiple Item objects.
So much for a little background info. Now for the bug.....
I have a object with the following signature:
public class DynamicFields : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
private int _Test;
public int Test
{
get { return _Test; }
set { _Test = value; PropertyChangedHandler("Test"); }
}
public DynamicFields() { }
public void PropertyChangedHandler(string propertyName)
{
PropertyChangedEventHandler handler = PropertyChanged;
if (handler != null)
{
handler(this, new PropertyChangedEventArgs(propertyName));
}
}
// BUG: RadExpressionEditor sets a Handle on this.PropertyChanged, but doesnt have any Targetdelegate.
// Lets remove it here as a workaround!
public void RemoveLastPropertyChangedHandler()
{
Delegate RemoveDelegate = this.PropertyChanged.GetInvocationList().Last();
if (RemoveDelegate != null)
{
this.PropertyChanged -= (RemoveDelegate as PropertyChangedEventHandler);
}
}
Some other place in my code I do something like this:
//Window with ExpressionEditor that will be shown as a dialog
Window_ExpressionEditor ee = new Window_ExpressionEditor();
//FormelEditor is an instance of ExpressionEditor
ee.FormelEditor.Item = Device.dynamicFields;
//As soon the Item Property is set to my Dynamicobject, radExpressionEditor will subscribe to
//the PropertyChanged event but without any target method to call.
//So then ever I change the Value of a property the PropertyChangedHandler raises an exception.
//Workaround is to delete last entry of the GetInvocationList()
DynamicFields df = this.Device.dynamicFields;
df.RemoveLastPropertyChangedHandler();
This behaviour also occurs if I use a "normal" class without expanding the properties at runtime.
Right now my workaround runs fine, but would be nice to get this bug verified.
Oh and please implement radExpressionEditor.Items for multiple objects use ;-)
Thank you and my best regards, Martin