Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3698366
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T04:58:21+00:00 2026-05-19T04:58:21+00:00

I am finding that Design View (DV) is nice, but trying to change the

  • 0

I am finding that Design View (DV) is nice, but trying to change the way it automagically injects code into InitializeComponent is very hard. And sometimes its automagical code breaks the program.

For example, DV automatically sees every single property of my custom UserControl, and then it assigns every single property to some value in InitializeComponent. But I don’t want it to assign values to some of the properties because some of my setters will throw a runtime exception if not used correctly. I could correct InitializeComponent manually, but anytime I make a change to the design, SharpDevelop will just regenerate the function again.

And there’s another case where I have the Default Constructor set the size based upon certain factors, but then InitializeComponent will immediately set it to another static value.

How can I tell DV to not automagically assign values to certain properties I define?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T04:58:22+00:00Added an answer on May 19, 2026 at 4:58 am

    Unless I misunderstood your scenario, it seems like you’re barking up the wrong tree by trying to modify or reconfigure SharpDevelop’s behavior. Even if you manage to change it, you won’t affect Visual Studio’s behavior, and you won’t help any of the other consumers of your custom control who don’t happen to (and/or don’t want to) configure their designer accordingly.

    Instead, it seems that you should just mark the properties exposed by your custom control with the [DesignerSerializationVisibility] attribute. This indicates to the designer exactly how that property’s value should be serialized into the InitializeComponent method.

    You have a choice of three different values:

    • Visible indicates that the value for the property should be persisted in initialization code
    • Hidden indicates that the value for the property should not be persisted in initialization code
    • Content indicates that initialization code should be generated for each public (not hidden) property of the object assigned to the property

    The default value is Visible, which causes a property’s value to be serialized whenever possible.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to design a tumblr theme. I am finding that it is
I am actually finding that chkContactType.Items is empty when I step through the code.
I'm finding that the code that I write in my controllers is largely repetitive
I'm looking into the whole responsive design thing and finding fluid grids great for
I'm trying to figure out the best way to design a rails model. For
I'm finding that I need to write a lot of duplicate code given that
I'm finding a good design pattern to skin an app. Suppose that... you 've
I'm finding that I can't access the admin shares on an XP64 box when
I keep finding that if I have nested divs inside each other, and one
I'm finding that hitting the Refresh button on my browser will temporarily screw up

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.