[CSharp.net] Immernoch zu doof für ein WinForm UserControl

Mansur Esmann [OM] csharp.net at glengamoi.com
Thu, 8 Jul 2004 09:47:47 +0200


Ich begreifs immernoch nicht so richtig mit den UserControls..

Ich habe ein UserControl, daß aus einem Label (Titel) und einer TextBox besteht ...

Dieses UserControl hat einige "individuelle" Properties
Bspw.:

		[System.ComponentModel.Category("Behavior")]
		public ValidationType Validation
		{
			get {return _validationType;}
			set
			{
				_validationType = value;
				this.Invalidate();
			}
		}
		[Flags]
		public enum ValidationType
		{
			None		= 0,
			Text		= 1 << 0,
			Currency	= 1 << 1,
			Date		= 1 << 2,
			Year		= 1 << 3,
			MonthYear	= 1 << 4,
			Percentage	= 1 << 5,
			eMail		= 1 << 6,
			PLZ			= 1 << 7
		}
		private ValidationType _validationType;
		[System.ComponentModel.Category("Behavior")]
		public ValidationType Validation
		{
			get {return _validationType;}
			set
			{
				_validationType = value;
				this.Invalidate();
			}
		}

... Soll also u.A. den Validator gleich mitliefern.

Leider geht aber folgendes nicht so richtig:
		[System.ComponentModel.Category("Appearance"), System.ComponentModel.Description("The defaulttext
of the textbox.")]
		public override string Text
		{
			get {return _text;}
			set
			{
				_text = value;
				this.Invalidate();
			}
		}

Ich möchte gerne das Property "Text" im Designer angezeigt bekommen ....
Im WinForm, wo ich das UserControl einsetze kann ich problemlos folgendes schreiben:
myTextBox.Text = "blafasel";

Ich habe aber das Property nicht im Eigenschaftenexplorer von VS ...
Wie muss ich vorgehen?


Zweite Frage wäre dann noch (aber nicht ganz so wichtig):
Ich habe ja Bspw. auch ein Enum drinnen, daß ganz gut funzt. Der einzige Haken daran ist jedoch das
"Validation" sollte eine multiselect sein .... Ich hatte gehoft, daß weil das Enum so gestaltet ist,
daß ich dann automatisch ein multiselect bekomme ...

Viele viele Fragen ....
Vielleicht weiß jemand Rat.

Mansur