A Couple of questions about the Property Grid

C

chris.dannemiller

1. I have a MDI document what is the best way to link data form a
specific MDI document to parameters of a property grid. In this case I
have a palette that can change from document to document, and I want my
customized color picker to support the diffrent palettes depending on
what document is active.

2. I have a large set of bjects that use a single class in the Property
grid, However the classes that derive this need to ensure that certain
parameters remain set when ConvertFrom is called because they are
static values.

- Christopher Dannemiller.
 
N

Nicholas Paldino [.NET/C# MVP]

Chris,

For #1, the easiest way to do this would be to create a class that
exposes the properties that you want which you can bind to the property
grid.

For #2, in your derived classes, just throw an exception when the
property is set with an invalid value. It will prevent the value from being
entered.

Hope this helps.
 
C

chris.dannemiller

This isn't exactly what I want, so let me try to explain what I am
trying to do.

I have a property that can bind to a set of data that the user can set
elsewhere in the document or here. So I want it to drop a list, using
the string converter if possible that looks something like this

+ SomeObject | Data
(Disabled)
OtherObjectA
OtherObjectB
OtherObjectC
(New Object)

When "(New Object)" is clicked I want it to create a window that
allows the users to create a new object and click Ok, naturally a
Cancel will be present too. This list of objects is unique for each
document. Additionally, the SomeObject has a filtering parameter that
tells it what objects can be used and what objects can not be used. It
sounds kind of counter intuitive from a Human Factoring stand point but
it actually will work in a very eloquent way. I am beginning to believe
that the only way to do this is with the "..." button but I wanted to
avoid that because about 90% of the time the user would select one of
the objects that already exists.
Chris,

For #1, the easiest way to do this would be to create a class that
exposes the properties that you want which you can bind to the property
grid.

For #2, in your derived classes, just throw an exception when the
property is set with an invalid value. It will prevent the value from being
entered.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

1. I have a MDI document what is the best way to link data form a
specific MDI document to parameters of a property grid. In this case I
have a palette that can change from document to document, and I want my
customized color picker to support the diffrent palettes depending on
what document is active.

2. I have a large set of bjects that use a single class in the Property
grid, However the classes that derive this need to ensure that certain
parameters remain set when ConvertFrom is called because they are
static values.

- Christopher Dannemiller.
 

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

Top