Is it possible to add CF user controls to ToolBox in VS 2005?

G

Guest

Is it possible to add custom user controls to the VS 2005 toolbox in CF 2.0
as you can with the full .net version? It doesn't appear so and I am not
sure why. I only thought this affected design time behavior not run time.
 
T

Tim Wilson

Yes. The control will only show up for the proper project type, however. So
if the control was compiled against CF 1.0 then, once added, it wouldn't
appear in the toolbox for a project that was targeting CF 2.0. Or, the
control should be added to the toolbox automatically (for the local solution
only) if the control is defined within the loaded solution. What are you
having problems with in particular?
 
G

Guest

When I apply [TooBoxItem(...)] or any variant the compiler tells me that no
such object exists. I have no problem with non CF projects.
 
T

Tim Wilson

Are you referring to programmatically (through code) adding CF controls to
the toolbox or manually by right-clicking on the toolbox, bringing up the
dialog, etc.?

--
Tim Wilson
..NET Compact Framework MVP

RFlaugher said:
When I apply [TooBoxItem(...)] or any variant the compiler tells me that no
such object exists. I have no problem with non CF projects.

Tim Wilson said:
Yes. The control will only show up for the proper project type, however. So
if the control was compiled against CF 1.0 then, once added, it wouldn't
appear in the toolbox for a project that was targeting CF 2.0. Or, the
control should be added to the toolbox automatically (for the local solution
only) if the control is defined within the loaded solution. What are you
having problems with in particular?

--
Tim Wilson
..NET Compact Framework MVP

CF
2.0 time.
 
G

Guest

I have created a "user control". According to the documentation I found you
need to add:

[ToolboxItem("System.Windows.Forms.design.AutoSizeToolBoxItem,System.Design")]
class MyControl : UserControl
{
.....
}

Now, I would think this wouldn't be executed at run time but at design time.

Tim Wilson said:
Are you referring to programmatically (through code) adding CF controls to
the toolbox or manually by right-clicking on the toolbox, bringing up the
dialog, etc.?

--
Tim Wilson
..NET Compact Framework MVP

RFlaugher said:
When I apply [TooBoxItem(...)] or any variant the compiler tells me that no
such object exists. I have no problem with non CF projects.

Tim Wilson said:
Yes. The control will only show up for the proper project type, however. So
if the control was compiled against CF 1.0 then, once added, it wouldn't
appear in the toolbox for a project that was targeting CF 2.0. Or, the
control should be added to the toolbox automatically (for the local solution
only) if the control is defined within the loaded solution. What are you
having problems with in particular?

--
Tim Wilson
..NET Compact Framework MVP

Is it possible to add custom user controls to the VS 2005 toolbox in CF
2.0
as you can with the full .net version? It doesn't appear so and I am not
sure why. I only thought this affected design time behavior not run time.
 
T

Tim Wilson

You shouldn't need any attributes to get the control to show in the toolbox.
For example, if you create a PPC 2003 smart device "Control Library" project
targeting CF 2.0, build the project, and then add a PPC 2003 smart device
"Device Application" project to the same solution, with the form designer
visible you should see the custom control at the top of the toolbox. You can
drag and drop this control onto any form within the same solution. If you
wanted to add this control to the toolbox so that it can be used from within
any CF 2.0 solution then you'd just right-click in the toolbox, select
"Choose Items...", and then locate the control assembly.

--
Tim Wilson
..NET Compact Framework MVP

RFlaugher said:
I have created a "user control". According to the documentation I found you
need to add:

[ToolboxItem("System.Windows.Forms.design.AutoSizeToolBoxItem,System.Design"
)]
class MyControl : UserControl
{
....
}

Now, I would think this wouldn't be executed at run time but at design time.

Tim Wilson said:
Are you referring to programmatically (through code) adding CF controls to
the toolbox or manually by right-clicking on the toolbox, bringing up the
dialog, etc.?

--
Tim Wilson
..NET Compact Framework MVP

RFlaugher said:
When I apply [TooBoxItem(...)] or any variant the compiler tells me
that
no
such object exists. I have no problem with non CF projects.

:

Yes. The control will only show up for the proper project type,
however.
So
if the control was compiled against CF 1.0 then, once added, it wouldn't
appear in the toolbox for a project that was targeting CF 2.0. Or, the
control should be added to the toolbox automatically (for the local solution
only) if the control is defined within the loaded solution. What are you
having problems with in particular?

--
Tim Wilson
..NET Compact Framework MVP

Is it possible to add custom user controls to the VS 2005 toolbox
in
CF
2.0
as you can with the full .net version? It doesn't appear so and I
am
not
sure why. I only thought this affected design time behavior not
run
time.
 

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