We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Custom Properties II

Hi, I''ve read the post "Custom properties in propertyEditor" but I''m having difficulties to add custom properties to a symbol. I''ve looked at the "CustomSymbol" sample and I understood how it worked. But the behaviour I want is just like in diagram builder. I want to drag and drop a symbol and see just the properties I want. (just like you have in CustomSymbol sample). The problem is that it seems there''s no straighforward way to do this without envolving some new classes. What''s the simplest way do to it keeping a palletegroupbar and registering some of the symbols to behave that way ? By the way, if you do a sample, please do it for VS2002 and not VS2003. If anyone is using VS2003 they can import it but otherwise it''s not possible. Regards, Jose Santos

3 Replies

AD Administrator Syncfusion Team September 14, 2004 12:18 AM UTC

Hi Jose, You can control the properties displayed for a symbol as demonstrated in the CustomSymbol sample. Only 4 properties (Name, ClickCount, Labels, DefaultLabelName) are displayed (take a look at the at the code in MySymbol.cs.). Here is a modified version of the CustomSymbol sample in which you can drag and drop the CustomSymbol from the PaletteGroupView control. Regards, Arun

JS Jose Santos September 14, 2004 07:10 AM UTC

Hi, Thank you for your reply and sample. I''ve done a similar thing yesterday but the symbol didn''t drop from the pallete to the diagram. I don''t know why. Probably it''s a property that needs to be set. Any idea ? With "regular" symbols I''ve no problem dropping them. There''s a lot of code in this sample (the part of load palette) that isn''t needed, right ? It''s needed it custom symbol original sample but with the palette it''s not. About custom properties, how can I make them writable ? In the sample the only custom property is read-only and in mysymbol.cs I don''t see anything telling it to be read-only.Is it the default ? Another thing, I wanted my custom property to allow a browse for a file in disk (just like you palette property in palettegroupview component). How can it be done ? Regards and thanks for your attention, Jose Santos

AD Administrator Syncfusion Team September 15, 2004 06:00 PM UTC

Hi Jose 1. The SymbolModel has two properties: PluginAssembly and PluginClass. At runtime, when you try to create an instance of a Symbol using the SymbolModel it looks at that PluginAssembly and PluginClass and once it has the PluginAssembly, it creates an instance of the PluginClass and loads the SymbolModel information into that newly created plugin Symbol. So you need to ensure that the assembly reference in the SymbolModel is available to your application and that it contains the PluginClass.So to use the Palette (customsymbol.edp) in your application, you can build the CustomSymbol sample as a dll (CustomSymbol.dll) and add this dll to your list of references in your application. Currently, the dll is not automatically loaded when the application starts up and the Essential Diagram team will be making some changes, but you can work around this by calling: Assembly.LoadFrom("CustomSymbol.dll"); to ensure that the assembly containing the Custom Symbol is loaded. Now you should be able to drag symbols (MySymbol) from this palette in your application. 2. Yes, you are correct as this sample demonstrates how you can add symbols to the Diagram without using the PaletteGroupBar/PaletteGroupView. 3. If you examine ClickCount in MySymbol.cs you will notice that only get is implemented where the ClickCount is obtained from GetPropertyValue and there is no set implemented. 4. Here is a link to a nice MSDN Article which should help you implement what you are seeking. Regards Arun

Live Chat Icon For mobile
Up arrow icon