Ed,
I'm writing a managed VSIP package - actually based on the Project sample
that shipped in Beta 1. The sample Project class has a GetNodeProperties()
method that I override to supply my properties object. As far as I can tell,
this is used to return the property, __VSHPROPID.VSHPROPID_BrowseObject on
the IVsProject interface.
As mentioned, I wrap this object with one that implements
ICustomTypeDescriptor, which generates custom PropertyDescriptor's which
override IsReadOnly() to dynamically determine if the property is read only.
So setting one property to "False" might make another property read-only. It
appears that the property grid does go thru and re-evaluate the items (my
IsReadOnly() methods gets called again for each item), but the control
doesn't actually redraw these items grayed & disabed. Using a standard
property grid, Refresh() causes it to redraw correctly.
I appreciate it's not ideal for a properties object to know anything about
the property grid that's displaying it, and I'd certainly rather it didn't
have to. I looked at whether the PropertyDescriptor, ICustomTypeDescriptor
might get to know about what was using them, but the property grid doesn't
appear to use any notifications (e.g. add itself as a listener to value
changed events), or interestingly use PropertyDescriptor::SetValue() to set
the value.
Being able to dynamically enable/disable controls is very useful, so I'd
very much like to see the property grids support it. If necessary, I'm happy
to publish some sample code. If there's an easier way to do it than my
approach, I'd very much like to know.
Thanks in advance
Mark.
> Hi Mark,
>
[quoted text clipped - 5 lines]
>
> This post is 'AS IS' with no warranties, and confers no rights.