How to build a control with a property like ...

F

Frankk

In the Windows dataGrid component, there is a Collection property -
TableStyles. This property can popup a Collection Editor and allow items to
be added to the property. How is this fancy property being built in a custom
component? All the available examples involves only the very simple Get/Set
examples. The properties in the dataGrid component is also grouped and can
be expanded/compressed. Where can I find info to learn how to do that.

Thanks in advance,

Frank
 
F

frankk

Matt said:
Hello Frankk,

Look for information around TypeConverter and TypeEditor.
Matt,

That helped me solved the second half of the problem. Is there any
simple complete code that you know of in the Editing collection property
to setup something like the TableStyle property.

Thanks,


Frank
 
F

frankk

Matt said:
Hello Frankk,

Try this thread [1]. Also, I realize that I gave the wrong name for the
TypeEditor class; it should have been UITypeEditor. More specifically,
for what you'd like to do is probably CollectionEditor.

There's an abundance of information [2] available on overriding
CollectionEditor to provide this type of design experience.

[1] http://www.dotnet247.com/247reference/msgs/5/28145.aspx
[2] http://www.codeproject.com/csharp/DzCollectionEditor.asp

--
Matt Berther
http://www.mattberther.com
Matt,

That helped me solved the second half of the problem. Is there any
simple complete code that you know of in the Editing collection
property to setup something like the TableStyle property.

Thanks,

Frank
Matt,

Thanks, Article # 2 is very close to what I am after. I'll study that.

Frank
 
F

frankk

frankk said:
Matt said:
Hello Frankk,

Try this thread [1]. Also, I realize that I gave the wrong name for
the TypeEditor class; it should have been UITypeEditor. More
specifically, for what you'd like to do is probably CollectionEditor.

There's an abundance of information [2] available on overriding
CollectionEditor to provide this type of design experience.

[1] http://www.dotnet247.com/247reference/msgs/5/28145.aspx
[2] http://www.codeproject.com/csharp/DzCollectionEditor.asp

--
Matt Berther
http://www.mattberther.com
Matt Berther wrote:

Hello Frankk,

Look for information around TypeConverter and TypeEditor.

--
Matt Berther
http://www.mattberther.com

In the Windows dataGrid component, there is a Collection property -
TableStyles. This property can popup a Collection Editor and allow
items to be added to the property. How is this fancy property being
built in a custom component? All the available examples involves
only the very simple Get/Set examples. The properties in the
dataGrid component is also grouped and can be expanded/compressed.
Where can I find info to learn how to do that.

Thanks in advance,

Frank

Matt,

That helped me solved the second half of the problem. Is there any
simple complete code that you know of in the Editing collection
property to setup something like the TableStyle property.

Thanks,

Frank
Matt,

Thanks, Article # 2 is very close to what I am after. I'll study that.

Frank
Article #2 uses the PropertyGrid in a custom control and not as a
component at design time.
 
M

Matt Berther

Hello Frankk,
Article #2 uses the PropertyGrid in a custom control and not as a
component at design time.

I dont follow... If you derive from CollectionEditor, you should get the
property grid as part of the designer. The only thing you'll need to feed
it is a collection and it will infer the display values from contained members.
 
F

frankk

Matt said:
Hello Frankk,



I dont follow... If you derive from CollectionEditor, you should get the
property grid as part of the designer. The only thing you'll need to
feed it is a collection and it will infer the display values from
contained members.
Any idea where to locate some sample code just to do that?

Thanks,

Matt
 
F

frankk

Matt said:
Hello Frankk,

'CollectionEditor, How to'. This walks you through it step-by-step.
Matt,
I must be asking the wrong question or the way I want to capture data
entry via desing time properties is not valid. I do not find a single
sample doing design time collectioneditor/propertygrid (.NetMonster has
a lot of reference). If it is not desing time then the data entries have
to be saved a run time and reloaded at runtime again unlike desing time
which the data are saved when the code application is saved. I have to
figuer some other way to do that.

Thanks,

frankk
 
M

Matt Berther

Hello Frankk,

Let me restate your question to make sure I understand:

You want to expose a collection property from one of your custom controls.
You would like the user to be able to click the ellipsis and have a collection
editor come up.

When the user makes selections to this collection editor, those selections
should be persisted to code (probably in the InitializeComponent section).

Am I understanding your situation correctly, and if so, where are you currently
stuck?
 
F

frankk

Matt said:
Hello Frankk,

Let me restate your question to make sure I understand:

You want to expose a collection property from one of your custom
controls. You would like the user to be able to click the ellipsis and
have a collection editor come up.

When the user makes selections to this collection editor, those
selections should be persisted to code (probably in the
InitializeComponent section).

Am I understanding your situation correctly, and if so, where are you
currently stuck?

--
Matt Berther
http://www.mattberther.com

Matt,
controls

-----------------------------------------------------------------------

There is no "custom controls" and no "run time", just a non-visual
component at design time. In the component, I have ->

public string prop1 {get {return rip;} set {rip = value;}}
public string prop2 {get {return rport;} set {rport = value;}}

when I compile the component and then load that onto a test Winform, I
see 2 properties at desing time (prop1 and prop2).

How can I setup a prop3 get/set as a collection property just like the
TablStyle property (Collection ...) so at design time, user can "Add" to
the collection and fill in the properties (right pane).

At run time, user can then retrieve the "items" entered at design time
and then use the data for the application. When user save the file, all
the data entered in "prop3" will be retained. I thoguht this would be a
great and flexible way for user to enter a collection of data in the
component. In my case, it would be the actual Ethernet devices that the
applciation is controlling.

Using the "popular" user control (run time) approach, all data entered
in run time has to be saved and then reloaded at the next run. I noticed
that in the TableStyle collection property of the dataGrid, once you
defined the TableStyle at Design time, the dataGrid will be displayed at
run time accordingly and you do not have to do any coding at all. I am
trying to use this idea excepted that I want to do it in the non-visual
component instead of a user control (visual).

Is this possible?

Thanks,


Frankk
 
M

Matt Berther

Hello Frankk,

Ahhhh... The non-visual part screwed me up. Let me research and get back
to you if I find something.
 
F

frankk

Matt said:
Hello Frankk,

Ahhhh... The non-visual part screwed me up. Let me research and get back
to you if I find something.
Matt,

Thanks for your looking into this idea. Do you think it is possible.
Certainly the dataGrid component has a TableSTyle like that. But it is a
visual component. Even visual component is acceptable as long as the
(Collection property...) is in design time in order to store data.

Frankk
 

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