Properties for Usercontrol unknown ?

P

Peter

Hello all,


How can I make some extra properties for a UserControl ?
In Form1 there is panel1 in which the UserControl is made visible:
the UserControl is created by simply add new UserControl to my app. and
looks like a form on which I can place controls.
Want to create extra properties for the UserControl but these properties are
unknown in Form1.
Can somebody help me how I get this done if possible ?

Thanks,
Peter.

// Form1 :

public Control myUsrCtrl = new UsrCtrl();

this.panel1.Controls.Add(myUsrCtrl);

myUsrCtrl.Visible = true;


// UserControl :

public partial class UsrCtrl : UserControl

{



private Color myColor = Color.White
public Color MyColor

{

get { return myColor; }

set { myColor = value; }

}
 
P

Peter

Hi Chris,

Thanks for the good link....
I tried to make the property browsable
<Property Name="MyColor">

<Browsable>true</Browsable>

</Property>

Nothing happens,

Still the property is not available (it's public)

What I try to do is change / set some simple things programmaticly , now the
compiler is creating a Dll ? I was not trying to create a total new
component...

Is there a other way ?

Thanks,

Peter
 
P

Peter

Hi Chris,

Thanks again !
Maybe I'm a dummy, but how to add it ? (I'm not sure....)
I don't won't to install it as a component and deploy no extra dll's with
the application.
Can you help me again ?

Thank you very much for your time
Peter.
 
P

Peter Foot [MVP]

Select Project > Add New Item then select Design-Time Attribute File from
the dialog. When you build these attributes in an additional dll is created
with the asmmeta.dll suffix. You don't need to deploy this with your
application, this is only for Visual Studio to use at design-time.

Peter

--
Peter Foot
Device Application Development MVP
www.peterfoot.net | www.inthehand.com

Peter said:
Hi Chris,

Thanks again !
Maybe I'm a dummy, but how to add it ? (I'm not sure....)
I don't won't to install it as a component and deploy no extra dll's with
the application.
Can you help me again ?

Thank you very much for your time
Peter.



The designer probably can't find your XMTA file.

-Chris

Peter said:
Hi Chris,

Thanks for the good link....
I tried to make the property browsable
<Property Name="MyColor">

<Browsable>true</Browsable>

</Property>

Nothing happens,

Still the property is not available (it's public)

What I try to do is change / set some simple things programmaticly , now
the compiler is creating a Dll ? I was not trying to create a total new
component...

Is there a other way ?

Thanks,

Peter



"<ctacke/>" <ctacke[@]opennetcf[dot]com> schreef in bericht
You need to add the dsign time attribute file (xmta) and in it you need
to add the custom attribute and make the property browsable.

http://www.mooseworkssoftware.com/VS2005 Control.htm


--
Chris Tacke - Embedded MVP
OpenNETCF Consulting
Managed Code in the Embedded World
www.opennetcf.com
--


"Peter" <.> wrote in message
Hello all,


How can I make some extra properties for a UserControl ?
In Form1 there is panel1 in which the UserControl is made visible:
the UserControl is created by simply add new UserControl to my app.
and looks like a form on which I can place controls.
Want to create extra properties for the UserControl but these
properties are unknown in Form1.
Can somebody help me how I get this done if possible ?

Thanks,
Peter.

// Form1 :

public Control myUsrCtrl = new UsrCtrl();

this.panel1.Controls.Add(myUsrCtrl);

myUsrCtrl.Visible = true;


// UserControl :

public partial class UsrCtrl : UserControl

{



private Color myColor = Color.White
public Color MyColor

{

get { return myColor; }

set { myColor = value; }

}
 
P

Peter

Hi Peter , Chris,

Thanks for the help , I'm getting the hang of it...

I followed the step by step walktrough of this url
http://msdn2.microsoft.com/library/ms180789(en-us,vs.80).aspx

At first it was not working because I have all my projects and data on a
different partion of my harddisk....
When I did the walktrough again but now in the path of the Visual studio
projects location everything worked fine....
So, I guess Chris is right that the designer can't find your XMTA file aldo
I added the XMTA file to the project, how very odd....

Changing the Visual Studio projects location path did the trick, but when
adding a new project in a different folder it's not working...

Is the any possible way to set Visual studio up that it looks in more then
one path. ?
For example I want to save my mobile apps in a different directory then my
Desktop apps.

Thanks for all the help and input
Regards,
Peter




Peter Foot said:
Select Project > Add New Item then select Design-Time Attribute File from
the dialog. When you build these attributes in an additional dll is
created with the asmmeta.dll suffix. You don't need to deploy this with
your application, this is only for Visual Studio to use at design-time.

Peter

--
Peter Foot
Device Application Development MVP
www.peterfoot.net | www.inthehand.com

Peter said:
Hi Chris,

Thanks again !
Maybe I'm a dummy, but how to add it ? (I'm not sure....)
I don't won't to install it as a component and deploy no extra dll's with
the application.
Can you help me again ?

Thank you very much for your time
Peter.



The designer probably can't find your XMTA file.

-Chris

"Peter" <.> wrote in message
Hi Chris,

Thanks for the good link....
I tried to make the property browsable
<Property Name="MyColor">

<Browsable>true</Browsable>

</Property>

Nothing happens,

Still the property is not available (it's public)

What I try to do is change / set some simple things programmaticly ,
now the compiler is creating a Dll ? I was not trying to create a total
new component...

Is there a other way ?

Thanks,

Peter



"<ctacke/>" <ctacke[@]opennetcf[dot]com> schreef in bericht
You need to add the dsign time attribute file (xmta) and in it you
need to add the custom attribute and make the property browsable.

http://www.mooseworkssoftware.com/VS2005 Control.htm


--
Chris Tacke - Embedded MVP
OpenNETCF Consulting
Managed Code in the Embedded World
www.opennetcf.com
--


"Peter" <.> wrote in message
Hello all,


How can I make some extra properties for a UserControl ?
In Form1 there is panel1 in which the UserControl is made visible:
the UserControl is created by simply add new UserControl to my app.
and looks like a form on which I can place controls.
Want to create extra properties for the UserControl but these
properties are unknown in Form1.
Can somebody help me how I get this done if possible ?

Thanks,
Peter.

// Form1 :

public Control myUsrCtrl = new UsrCtrl();

this.panel1.Controls.Add(myUsrCtrl);

myUsrCtrl.Visible = true;


// UserControl :

public partial class UsrCtrl : UserControl

{



private Color myColor = Color.White
public Color MyColor

{

get { return myColor; }

set { myColor = value; }

}
 

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