PC Review


Reply
Thread Tools Rate Thread

Advance Property Grid Manipulation

 
 
John Kraft
Guest
Posts: n/a
 
      25th Aug 2006
Hi all,

I'm trying to use a property grid, and what I'm trying to do seems to
really elude me. I've been using the property grid for a short period
of time, and this is the first thing I haven't been able to do.

I have some products... like t-shirts... and these products have
particular property / value pairs. I'd like the property grid to look
like this:

Category Clothing
Type T-Shirt
Properties
Color Purple
Material Cotton
Size XL

I'd even settle for something like:

Category Clothing
Type T-Shirt
Properties
Property
Name Color
Value Purple
Property
Name Material
Value Cotton

.... or...

Category Clothing
Type T-Shirt
Properties
[0]
Name Color
Value Purple
[1]
Name Material
Value Cotton

The problem is that I don't know the properties or the values. Both
are dynamic. That is that I have no idea what the properties (color
material size) or values (purple, cotton, xl) are. The product object
uses a SortedList<string, string> (i've also tried using arrays and
other structures) to store the key and value. And, additionally, I'd
like the value to be able to show a dropdown of all the possible
values for that key.

What I keep ending up with is something like:

Category Clothing
Type T-Shirt
Properties
Properties (Collection)

The collection brins up the collection editor, but I can't add or
change anything.

When I tried using arrays (and other structures), I ended up with
something like:

Category Clothing
Type T-Shirt
Properties
[0] Color
[1] Material
[2] Size

As you can see, neither of these is acceptable because it does not
give the user the desired editing capabilities of the above examples.
I've been using the MSDN article at
http://msdn.microsoft.com/library/de...ngpropgrid.asp
It has given me a really good starting point, but I just can't seem to
get any more out of the grid. Has anyone else attempted something
like this? Does anyone have any good examples or links?

Sincerely,

John Kraft
 
Reply With Quote
 
 
 
 
Greg Cadmes
Guest
Posts: n/a
 
      26th Aug 2006
Hi John,

I am writing you with the assumtion that you know something about .NETs
TypeConverter or the ExpandableObjectConverter classes.

Personally, I haven't had the need for custom (dynamic)
properties/values as you described in your post, however, I found
several PropertyGrid articals on CodeProject.com where each example
implements different flavors of the PropertyGrid. I am about to post my
first artical/example with code snippets and credits of all
PropertyGrid articals combined. Stay tuned...it will be a more
advanced PropertyGrid with all the trimmings. (including- dynamic
properties, tabbing through GridItems, PropertySorting, dynamic code
generation,...etc)

But since I havn't posted yet, here is (IMO) the best PropertyGrid
example that should get you in the direction you need to go.
http://www.codeproject.com/useritems/PropertyGridEx.asp

Cheers,
Greg Cadmes


John Kraft wrote:
> Hi all,
>
> I'm trying to use a property grid, and what I'm trying to do seems to
> really elude me. I've been using the property grid for a short period
> of time, and this is the first thing I haven't been able to do.
>
> I have some products... like t-shirts... and these products have
> particular property / value pairs. I'd like the property grid to look
> like this:
>
> Category Clothing
> Type T-Shirt
> Properties
> Color Purple
> Material Cotton
> Size XL
>
> I'd even settle for something like:
>
> Category Clothing
> Type T-Shirt
> Properties
> Property
> Name Color
> Value Purple
> Property
> Name Material
> Value Cotton
>
> ... or...
>
> Category Clothing
> Type T-Shirt
> Properties
> [0]
> Name Color
> Value Purple
> [1]
> Name Material
> Value Cotton
>
> The problem is that I don't know the properties or the values. Both
> are dynamic. That is that I have no idea what the properties (color
> material size) or values (purple, cotton, xl) are. The product object
> uses a SortedList<string, string> (i've also tried using arrays and
> other structures) to store the key and value. And, additionally, I'd
> like the value to be able to show a dropdown of all the possible
> values for that key.
>
> What I keep ending up with is something like:
>
> Category Clothing
> Type T-Shirt
> Properties
> Properties (Collection)
>
> The collection brins up the collection editor, but I can't add or
> change anything.
>
> When I tried using arrays (and other structures), I ended up with
> something like:
>
> Category Clothing
> Type T-Shirt
> Properties
> [0] Color
> [1] Material
> [2] Size
>
> As you can see, neither of these is acceptable because it does not
> give the user the desired editing capabilities of the above examples.
> I've been using the MSDN article at
> http://msdn.microsoft.com/library/de...ngpropgrid.asp
> It has given me a really good starting point, but I just can't seem to
> get any more out of the grid. Has anyone else attempted something
> like this? Does anyone have any good examples or links?
>
> Sincerely,
>
> John Kraft


 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Finding Grid Positions in a Property Grid James CC Microsoft C# .NET 0 30th May 2005 04:22 AM
Finding Grid Positions in a Property Grid James CC Microsoft Dot NET Framework Forms 0 28th May 2005 11:44 AM
FP2000 upgrade / table (grid) manipulation Jason Wood Microsoft Frontpage 1 17th Feb 2004 10:15 AM
Property Grid manipulation programmatically in .NET IDE Pertti Karjalainen Microsoft Dot NET Framework 0 1st Nov 2003 08:44 PM
Property Grid on a WinForm textchanged event on property input heikekrieg Microsoft Dot NET Framework Forms 0 20th Oct 2003 05:37 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:18 AM.