Click here to Skip to main content
16,017,726 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want attached properties to element's when i create them with C# code example set Name to TranslateTransform Class .

Is it Possible? if so, how?(please write example)

thanks.
Posted

Their is only one way I can think of: you have to "cheat".

Looks through the properties on the Element you are creating (e.g. UIElement), and find a string property that you won't use, and the control doesn't set either (e.g. some cultural language string). Then, you can use this to hold your data in a (e.g. string) format, and pull it out whenever you want.

If you could show which type of Element you are using, I might be able to post some code.

Hope this helps.

ge-force.
 
Share this answer
 
Use Constructors to initialize its values upon object creation.

http://msdn.microsoft.com/en-us/library/ms173115.aspx[^]

http://msdn.microsoft.com/en-us/library/ms173115%28v=vs.80%29.aspx[^]

I am not quite sure if Constructors will help you from your problem but from my point of view, that should do it :)

Regards,
Eduard
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900