Hide property in PropertyGrid
(Monday, December 27, 2004)
Found the following interesting discussion in the Newsgroups:
Hide property in PropertyGrid by:Anonymous
| I have a situation where I want to show a property when one object is selected in a PropertyGrid, but I want to hide that property when more than one object is selected. For example, lets say I have an object with a Name property that must be unique. If one of these objects is selected by a PropertyGrid, then I want to show the Name property in the PropertyGrid so the user can change the object's name. But, if more than one of these objects are selected, then I don't want to show the Name property in the PropertyGrid because setting the value would set all of the selected objects' names to the same value which is not allowed.
Any ideas?
Thank you, Lance
| | | Reply: by:v-yiy@online.microsoft.com (Ying-Shen Yu[MSFT])
| | | Hi Lance,
You may take a look at the System.ComponentModel.MergablePropertyAttribute class, http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/ frlrfsystemcomponentmodelmergablepropertyattributeclasstopic.asp
As the docuement describes propertyies marked with MergableProperty(false) must be displayed seperately, the default value for properties is true.
Does it resolve your problem? Feel free to reply this thread if you still have problems on this issue, By the way, if you have more design-time related issues you may also post them to their specific groups,
for winform design-time issues : microsoft.public.dotnet.windowsforms.designtime
for webform design-time issues : microsoft.public.dotnet.framework.aspnet.buildingcontrols
Thanks!
Best regards,
Ying-Shen Yu [MSFT] Microsoft Community Support Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties and confers no rights. This mail should not be replied directly, please remove the word "online" before sending mail.
| | | Reply: by:Anonymous
| | | Yes, that is exactly what I needed. Thank you!
| | | Reply: by:Jay B. Harlow [MVP - Outlook]
| | | Lance, Have you reviewed the info in the following articles?
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndotnet/html/usingpropgrid.asp
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndotnet/html/vsnetpropbrow.asp
Hope this helps Jay
|
|
0 Comments:
Post a Comment