I am using a class derived from SymbolLabel. These new labels are being added to a Symbol on my Diagram at run time. I wish to update a grid when the user updates the text of the label.
I can override the OnPropertyChanged event of the SymbolLabel but this causes the grid to be updated each time the label text is changed, ie. for each keystroke. It would be much more useful for me to have an OnLeave or OnExit event that I could use when the user has finished updating the text and focuses elsewhere.
Is this something that will be implemented in a future release of SyncFusion.Diagram or will I have to implement it myself?
ADAdministrator Syncfusion Team September 27, 2004 10:28 AM
You can examine the Model''s PropertyChanged event''s evtArgs to get the necessary information. Here is a code snippet that demonstrates what you are looking for. A MessageBox with the new value for the text of the Label in the Symbol is shown after you change the text of the label:
private void diagram1_Model_PropertyChanged(object sender, Syncfusion.Windows.Forms.Diagram.PropertyEventArgs evtArgs)
//Check for the type SymbolLabel
//Check for the Text property
if (evtArgs.PropertyName == "Text")
JBJames BrockSeptember 28, 2004 03:36 AM
Thanks for getting back to me so quick. I have tried what you have suggested and put a break within the method. When I update the label text the code never gets called, and hence doesn''t break.
Having said that, none of my "Diagram_Model_ events" seem to be working either.
Could this be to do with the fact that I am using a Custom SymbolLabel or that I am using a Custom Model?
ADAdministrator Syncfusion Team September 28, 2004 12:25 PM
In your custom Model''s PropertyChanged event you need to check for your Custom SymbolLabel type to do what you are seeking.
JBJames BrockSeptember 29, 2004 12:44 AM
After some work on this yesterday, it would appear that the method you used in the first place works when dealing with a brand new diagram.
However, when working with one that I have saved it doesn''t. I suspect that there may be an issue with my events not being wired up when I load the saved version. Will investigate further and also try adding them to MyModel class.
ADAdministrator Syncfusion Team September 29, 2004 02:36 PM
Yes, you are correct. Use the Diagram''s PropertyChanged event instead of the Diagram''s Model''s PropertyChanged event.
JBJames BrockSeptember 30, 2004 03:38 AM
I have now used the Diagram_PropertyChanged event and it works a treat.