Click here to Skip to main content
15,913,685 members
Home / Discussions / C#
   

C#

 
GeneralRe: Formating doubles Pin
Christian Graus17-Jan-05 12:25
protectorChristian Graus17-Jan-05 12:25 
GeneralRe: Formating doubles Pin
Stefan Troschuetz17-Jan-05 21:13
Stefan Troschuetz17-Jan-05 21:13 
GeneralWindows Installer questions... Pin
new_phoenix17-Jan-05 11:24
new_phoenix17-Jan-05 11:24 
GeneralRe: Windows Installer questions... Pin
Heath Stewart18-Jan-05 10:16
protectorHeath Stewart18-Jan-05 10:16 
GeneralAppending DataTable Pin
myNameIsRon17-Jan-05 11:10
myNameIsRon17-Jan-05 11:10 
GeneralRe: Appending DataTable Pin
Heath Stewart18-Jan-05 10:18
protectorHeath Stewart18-Jan-05 10:18 
Generalpropertygrid with browsable Pin
GoodQuestion17-Jan-05 11:04
GoodQuestion17-Jan-05 11:04 
GeneralRe: propertygrid with browsable Pin
Heath Stewart18-Jan-05 10:27
protectorHeath Stewart18-Jan-05 10:27 
The most robust solution is to implement ICustomTypeDescriptor in your class that is selected in the PropertyGrid. For most methods you can just return the value from the corresponding TypeDescriptor method overload that takes a bool determining whether or not to query any ICustomTypeDescriptor (the parameter is called noCustomTypeDesc), like:
TypeConverter void ICustomTypeDescriptor.GetConverter()
{
  return TypeDescriptor.GetConverter(this, true);
}
For ICustomTypeDescriptor.GetProperties you can return a BrowsableAttribute with the value you want, or just simply replace the PropertyDescriptor for your property in question with your own implementation that returns true or false for IsBrowsable.

This allows you to customize what component model viewers like the PropertyGrid see.

Also noticed how I used an explicit interface implementation above. This is best for interfaces where you don't want the members to be visible in the code editor and without having to use the EditorBrowsableAttribute. This is also commonly done for ISerializable and many other interfaces. It's completely valid and the only way to implement two like-named methods with different signatures required by different interfaces.

This posting is provided "AS IS" with no warranties, and confers no rights.

Software Design Engineer
Developer Division Sustained Engineering
Microsoft

[My Articles] [My Blog]
GeneralDateTime Save null Pin
webhay17-Jan-05 9:24
webhay17-Jan-05 9:24 
GeneralRe: DateTime Save null Pin
Christian Graus17-Jan-05 9:58
protectorChristian Graus17-Jan-05 9:58 
GeneralRe: DateTime Save null Pin
Heath Stewart17-Jan-05 10:58
protectorHeath Stewart17-Jan-05 10:58 
GeneralRe: DateTime Save null Pin
webhay17-Jan-05 11:46
webhay17-Jan-05 11:46 
GeneralRe: DateTime Save null Pin
Christian Graus17-Jan-05 12:29
protectorChristian Graus17-Jan-05 12:29 
Generalgdi line cursor Pin
bwagz17-Jan-05 9:14
bwagz17-Jan-05 9:14 
GeneralRe: gdi line cursor Pin
Heath Stewart17-Jan-05 11:04
protectorHeath Stewart17-Jan-05 11:04 
GeneralSerial Port (RS-232) Programming Pin
mci8407817-Jan-05 8:52
mci8407817-Jan-05 8:52 
GeneralRe: Serial Port (RS-232) Programming Pin
Jeff Bramwell17-Jan-05 10:20
Jeff Bramwell17-Jan-05 10:20 
GeneralControls Questions on winform. Pin
stan2817-Jan-05 8:17
stan2817-Jan-05 8:17 
GeneralRe: Controls Questions on winform. Pin
Anonymous17-Jan-05 9:38
Anonymous17-Jan-05 9:38 
GeneralRe: Controls Questions on winform. Pin
Dennis C. Dietrich17-Jan-05 10:31
Dennis C. Dietrich17-Jan-05 10:31 
GeneralRe: Controls Questions on winform. Pin
stan2818-Jan-05 5:03
stan2818-Jan-05 5:03 
Generalactive directory Pin
sujithapril17-Jan-05 7:21
sujithapril17-Jan-05 7:21 
GeneralC# app using Crystal Reports Pin
braber17-Jan-05 6:19
braber17-Jan-05 6:19 
GeneralXML-Updating of record Pin
Adnan Siddiqi17-Jan-05 6:14
Adnan Siddiqi17-Jan-05 6:14 
GeneralC# class hierarchy Pin
Peter Andersson17-Jan-05 5:50
Peter Andersson17-Jan-05 5:50 

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.