By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,077 Members | 2,160 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,077 IT Pros & Developers. It's quick & easy.

Hide property in PropertyGrid

P: n/a
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
Nov 20 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Hi Lance,

You may take a look at the System.ComponentModel.MergablePropertyAttribute
class,
http://msdn.microsoft.com/library/de...us/cpref/html/
frlrfsystemcomponentmodelmergablepropertyattribute classtopic.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.buildingc ontrols

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.

Nov 20 '05 #2

P: n/a
Lance,
Have you reviewed the info in the following articles?

http://msdn.microsoft.com/library/de...ngpropgrid.asp

http://msdn.microsoft.com/library/de...etpropbrow.asp

Hope this helps
Jay

"Lance" <zi***@hotmail.com> wrote in message
news:FD**********************************@microsof t.com...
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

Nov 20 '05 #3

P: n/a
Yes, that is exactly what I needed. Thank you!
Nov 20 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.