Click here to Skip to main content
15,912,932 members
Home / Discussions / C#
   

C#

 
QuestionHow to report changes in FTP server? Pin
mkomasi16-Dec-03 2:43
mkomasi16-Dec-03 2:43 
AnswerRe: How to report changes in FTP server? Pin
Heath Stewart16-Dec-03 3:24
protectorHeath Stewart16-Dec-03 3:24 
Generalshortcut on text-less button Pin
troels_sorensen16-Dec-03 2:08
troels_sorensen16-Dec-03 2:08 
GeneralRe: shortcut on text-less button Pin
Heath Stewart16-Dec-03 3:23
protectorHeath Stewart16-Dec-03 3:23 
Generaldetecting and editing extended properties Pin
pekai15-Dec-03 23:50
pekai15-Dec-03 23:50 
GeneralRe: detecting and editing extended properties Pin
Heath Stewart16-Dec-03 3:21
protectorHeath Stewart16-Dec-03 3:21 
GeneralRe: detecting and editing extended properties Pin
pekai16-Dec-03 3:50
pekai16-Dec-03 3:50 
GeneralRe: detecting and editing extended properties Pin
Heath Stewart16-Dec-03 4:05
protectorHeath Stewart16-Dec-03 4:05 
You should really read about providers. You're doing it completely wrong. You can just add a property like that - you can extend the MenuItem and add properties and methods, or you can create a type designer or editor that can simulate a property at design-time and that writes out code to make use of that "virtual" property. Essentially, this is what IExtenderProviders are, and you must implement that interface and provide the Type as the second parameter to the ProvidePropertyAttribute. Be sure to read about those two things in the .NET SDK documentation.

This amounts to another component that actually stores the values on behalf of the attributes class (or rather, and instance of that class). So, the MenuItem doesn't actually have that property, but another components would. If you name the property ImageIndex, then your extender provider would have a SetImageIndex and GetImageIndex method, as well as some optional specially-named methods to help with serialization.

There is a great couple articles about extender providers, including an example of what you're trying to do (adding an image easily to a menu) here at CP:It's always a good idea to try searching first before posting a question. Chances are that is has been asked / solved before and you'll get answers quicker than waiting for a reply.

Be sure to read the documentation for IExtenderProvider and ProvidePropertyAttribute as well.

 

-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
GeneralRe: detecting and editing extended properties Pin
pekai16-Dec-03 4:18
pekai16-Dec-03 4:18 
GeneralRe: detecting and editing extended properties Pin
Heath Stewart16-Dec-03 4:59
protectorHeath Stewart16-Dec-03 4:59 
Generalc# & pop_up menue Pin
amjadqaqa15-Dec-03 23:29
amjadqaqa15-Dec-03 23:29 
GeneralRe: c# & pop_up menue Pin
Member 26118815-Dec-03 23:46
Member 26118815-Dec-03 23:46 
GeneralC# & DOS Pin
15-Dec-03 21:20
suss15-Dec-03 21:20 
GeneralRe: C# & DOS Pin
Colin Angus Mackay15-Dec-03 22:18
Colin Angus Mackay15-Dec-03 22:18 
GeneralRe: C# & DOS Pin
Member 26118815-Dec-03 23:49
Member 26118815-Dec-03 23:49 
GeneralRe: C# & DOS Pin
Member 74694915-Dec-03 23:55
Member 74694915-Dec-03 23:55 
GeneralRe: C# & DOS Pin
Colin Angus Mackay16-Dec-03 0:06
Colin Angus Mackay16-Dec-03 0:06 
GeneralCustom Formborder style Pin
Anonymous15-Dec-03 20:53
Anonymous15-Dec-03 20:53 
GeneralRe: Custom Formborder style Pin
Member 26118815-Dec-03 23:52
Member 26118815-Dec-03 23:52 
GeneralBorland C#Builder Look and Feel Pin
Buddhika H.15-Dec-03 10:41
Buddhika H.15-Dec-03 10:41 
GeneralGrrr... c# Pin
Member 76889515-Dec-03 9:51
Member 76889515-Dec-03 9:51 
GeneralRe: Grrr... c# Pin
Christian Graus15-Dec-03 10:00
protectorChristian Graus15-Dec-03 10:00 
GeneralRe: Grrr... c# Pin
Heath Stewart15-Dec-03 10:10
protectorHeath Stewart15-Dec-03 10:10 
GeneralRe: Grrr... c# Pin
Christian Graus15-Dec-03 10:11
protectorChristian Graus15-Dec-03 10:11 
GeneralRe: Grrr... c# Pin
Heath Stewart15-Dec-03 10:13
protectorHeath Stewart15-Dec-03 10:13 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.