Highligting property grid lines

C

colin

Ive got my custom property grid to work ok,
but Id realy like to distinguish fields wich dont have their default value,
is there any way to specify diferent colors for different lines?

theres a couple of long pages on propertygrid on msdn,
but doesnt seem to tell how to do it, only alternative I can think of is to
partition
the table, or to put an asterisk in the field name or data,
or to partition all of wich arent ideal...

many thanks
Colin =^.^=
 
M

Marc Gravell

You can do the "bold" thing if that helps... for simple values, use
DefaultValueAttribute to specify the default; for more complex values,
provide a method

bool ShouldSerialize{PropertyName}() {...}

and return true if it is non-default.

Alternatively - there is a pretty good commercial alternative to
PropertyGrid - I looked at it once and it offered a lot of flexibility
(more than PropertyGrid) - but the name escapes me at the moment. I
could probably look it up if you wanted...

Marc
 
C

colin

Marc Gravell said:
You can do the "bold" thing if that helps... for simple values, use
DefaultValueAttribute to specify the default; for more complex values,
provide a method

bool ShouldSerialize{PropertyName}() {...}

and return true if it is non-default.

Alternatively - there is a pretty good commercial alternative to
PropertyGrid - I looked at it once and it offered a lot of flexibility
(more than PropertyGrid) - but the name escapes me at the moment. I
could probably look it up if you wanted...

Marc

many thanks, I had the defualt attribute supplied by my 'facade' :g
but i didnt notice any difference, however making the ShouldSerialize
to return true does make the data text apear bold, although this doesnt help
if the text is blank but if its blank then its not likely to be different
from defualt.

I had just about given up after finding a couple of threads on msdn wich
stated it
was imposible to change the color for each item such as ...
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2882205&SiteID=1
its a shame one cant just simply modify bits of it ...

I have many items wich are defined in base classes and so
a lot of the items havnt changed becuase they arnt relavent,
and so it would be useful to see quickly wich items are relavent/changed.

Im not interested in commercial items as this isnt realy a commercial
product.
im using this with the dockpanel 2.2 from the code project,
wich does a very nice IDE style dockable layout.
there are a couple of similar propertygrid controls but my experience
it can take quite some time to get to know how to use,
by wich time it seems like I could of written my own.


Colin =^.^=
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top