Click here to Skip to main content
15,907,329 members
Home / Discussions / C#
   

C#

 
GeneralRe: Email validation Pin
PrakashBhaskar4-Jan-06 22:12
PrakashBhaskar4-Jan-06 22:12 
QuestionWindow Service Pin
A.Grover4-Jan-06 19:47
A.Grover4-Jan-06 19:47 
AnswerRe: Window Service Pin
AB77714-Jan-06 21:35
AB77714-Jan-06 21:35 
GeneralRe: Window Service Pin
A.Grover5-Jan-06 20:55
A.Grover5-Jan-06 20:55 
QuestionAdapting the .net controls to touch screen Pin
engsrini4-Jan-06 19:42
engsrini4-Jan-06 19:42 
AnswerRe: Adapting the .net controls to touch screen Pin
VenkataRamana.Gali5-Jan-06 0:43
VenkataRamana.Gali5-Jan-06 0:43 
QuestionProperty Grid - Browsable Attributes Pin
Tulika Shrivastava4-Jan-06 19:29
Tulika Shrivastava4-Jan-06 19:29 
AnswerRe: Property Grid - Browsable Attributes Pin
microsoc5-Jan-06 23:26
microsoc5-Jan-06 23:26 
hi! Smile | :)

try to implement the ICustomTypeDescriptor interface on your control. then in the GetProperties overloaded methods, iterate all the properties then set the new attributes you want depending on your condition.

here's an example:

<code>
//custom method to prevent redundant statement
private PropertyDescriptorCollection x_HideShowProperties(PropertyDescriptorCollection baseProps)
{
PropertyDescriptor[] props = null;
for (int i = 0; i < baseProps.Count; i++)
{
if (/*condition here*/)
{
if (props == null)
{
props = new PropertyDescriptor[baseProps.Count];
baseProps.CopyTo(props, 0);
}

props[i] = TypeDescriptor.CreateProperty(
this.GetType(), baseProps[i], new BrowsableAttribute(false),
new DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Hidden));
}
}

if (props == null)
{
return baseProps;
}
else
{
return new PropertyDescriptorCollection(props);
}
}


PropertyDescriptorCollection ICustomTypeDescriptor.GetProperties()
{
return x_HideShowProperties(TypeDescriptor.GetProperties(this, true));
}


public PropertyDescriptorCollection GetProperties(Attribute[] attributes)
{
return x_HideShowProperties(TypeDescriptor.GetProperties(this, attributes, true));
}
</code>

then on your property(Simulation), add the attribute "RefreshProperties(RefreshProperties.All)".
this will refresh the propertygrid.

if your not yet familiar on this interface, just try to research it on the msdn or other .net help sites.

hope that helps. Smile | :)

microsoc

GeneralRe: Property Grid - Browsable Attributes Pin
Tulika Shrivastava30-Jan-06 23:37
Tulika Shrivastava30-Jan-06 23:37 
GeneralRe: Property Grid - Browsable Attributes Pin
microsoc30-Jan-06 23:40
microsoc30-Jan-06 23:40 
Questionping an address Pin
binglin4-Jan-06 17:35
binglin4-Jan-06 17:35 
AnswerRe: ping an address Pin
Dave Kreskowiak4-Jan-06 17:55
mveDave Kreskowiak4-Jan-06 17:55 
GeneralRe: ping an address Pin
binglin4-Jan-06 19:11
binglin4-Jan-06 19:11 
QuestionCannot add my Control to Form Pin
Tim McCurdy4-Jan-06 13:37
Tim McCurdy4-Jan-06 13:37 
AnswerRe: Cannot add my Control to Form Pin
AB77714-Jan-06 19:11
AB77714-Jan-06 19:11 
GeneralRe: Cannot add my Control to Form Pin
Tim McCurdy5-Jan-06 11:38
Tim McCurdy5-Jan-06 11:38 
QuestionGantt Chart Pin
ted_9214-Jan-06 13:18
ted_9214-Jan-06 13:18 
AnswerRe: Gantt Chart Pin
Christian Graus4-Jan-06 13:53
protectorChristian Graus4-Jan-06 13:53 
GeneralRe: Gantt Chart Pin
ted_9214-Jan-06 13:57
ted_9214-Jan-06 13:57 
GeneralRe: Gantt Chart Pin
Christian Graus4-Jan-06 14:04
protectorChristian Graus4-Jan-06 14:04 
AnswerRe: Gantt Chart Pin
Suelinda_W6-Jan-06 5:30
Suelinda_W6-Jan-06 5:30 
QuestionNeed to converty from VB or C++ to C# Pin
Hovik314-Jan-06 12:33
Hovik314-Jan-06 12:33 
AnswerRe: Need to converty from VB or C++ to C# Pin
Christian Graus4-Jan-06 13:52
protectorChristian Graus4-Jan-06 13:52 
GeneralRe: Need to converty from VB or C++ to C# Pin
Hovik314-Jan-06 13:58
Hovik314-Jan-06 13:58 
GeneralRe: Need to converty from VB or C++ to C# Pin
Christian Graus4-Jan-06 14:05
protectorChristian Graus4-Jan-06 14:05 

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.