StrataFrame Forum

Custom Property Tag in C#

http://forum.strataframe.net/Topic13274.aspx

By Bill Cunnien - 1/7/2008

I am trying to add some custom properties to my business objects and I ran across a couple of posts (e.g. http://forum.strataframe.net/Topic13021-10-1.aspx#bm13027) that show how to attach a tag so that the property will be reflected in the intellisense and elsewhere.  It is VB and looks like this: 

<Browsable(false),
BusinessFieldDisplayInEditor(),
Description(
"MyCustomProperty"),
DesignerSerializationVisibility(
DesignerSerializationVisibility.Hidden)>

Is there a different set of instructions in the C# environment?  I tried using some of the attribute options, but those are not acceptable to the compiler. 

Thanks!
Bill

By Greg McGuffey - 1/7/2008

Did you add using statements so the attributes can be seen?

using MicroFour.StrataFrame.UI.Windows.Forms;

using System.ComponentModel;


I think these are the two needed...check the help file for custom properties.





Second, just in case you aren't used to attributes with c#, they use square brackets, not angle brackets:

[Browsable(False),

BusinessFieldDisplayInEditor(),

Description("Full Name"),

DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
By Trent L. Taylor - 1/7/2008

I think that Greg nailed it.  One thing to keep in mind is that the namespaces and classes are the same whether you are using VB.NET or C#.  So usually this is the issue.  One thing that you can do also is to copy out the "using" statements from the top of the designer file of the BO and paste them in the BO.cs file.  This will ensure that you have all of the same imports.
By Bill Cunnien - 1/7/2008

If I had a dollar for every namespace missed...

Thanks!  I got it, now!
Bill

By Trent L. Taylor - 1/7/2008

Good deal Smile