I have question. I created a custom user control. My CustomUserControl is inherited from UserControl. I add some custom methods and properties in my CustomUserControl. I wanted to add my CustomUserControl to "Add New Item" in Visual Studio for projects.
For this I used "Item Template" and created a template. After restarting Visual Studio every thing was fine and I could add my CustomUserControl by using "Add New Item" in my project.
Just i have a problem when I add CustomUserControl to my project, the methods and properties that I am added into template file appeare and i can change them. How can I Hide methods and property in template? I don't want to see methods and properties after add CustomUserControl to project.
Note : When i add my CustomUserControl project, "CustomUserControl1" is created and it inherit from the UserControl not my CustomUserControl.
My Template is :
public partial class CustomUserControl : UserControl
{
private string _Version;
[Browsable(true), EditorBrowsable(EditorBrowsableState.Always)]
public string Version
{
get { return _Version; }
private set { _Version = value; }
}
private void InitRequirements()
{
try
{
// ... My Code
}
catch (Exception exp)
{
throw exp;
}
}
}
After adding to project :
public partial class CustomUserControl1 : UserControl
{
private string _Version;
[Browsable(true), EditorBrowsable(EditorBrowsableState.Always)]
public string Version
{
get { return _Version; }
private set { _Version = value; }
}
private void InitRequirements()
{
try
{
// ... My Code
}
catch (Exception exp)
{
throw exp;
}
}
}
it should be like this :
public partial class CustomUserControl1 : CustomUserControl
{
// Without showing methods and properties
}
Thank you Best regards,