Click here to Skip to main content
15,896,154 members
Articles / Programming Languages / C#

DropDownPanel

Rate me:
Please Sign up or sign in to vote.
4.87/5 (26 votes)
11 Feb 2007Public Domain4 min read 121.1K   2K   107  
A template for custom ComboBoxes
using System;
using System.ComponentModel;
using System.Windows.Forms;

using AT.STO.UI.Win;

namespace Demo
{
	internal class DerivedTreeCombo : DropDownPanel
	{
	#region Constructor / Destructor
		public DerivedTreeCombo() : base()
		{
			// The base class's property must be set because
			// this derived implementation hides the setter.
			base.DropDownControl = new DropDownTree();
			this.DropDownControl.BorderStyle = BorderStyle.None;
		}
	#endregion
	#region Public Properties
		/// <summary>
		/// Returns the DateRangePicker, that is displayed in the dropdown.
		/// </summary>
		[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
		public new DropDownTree DropDownControl				// new is on purpose to change the property's data type and to hide the setter.
		{
			get
			{ 
				if (base.DropDownControl != null)					
				{
					return base.DropDownControl as DropDownTree;
				}
				
				return null;
			}
		}
		
		public new DropDownNode Value
		{
			get 
			{
				if (this.DropDownControl != null)
				{
					return this.DropDownControl.Value as DropDownNode;
				}
				
				return null;
			}
			set { base.Value = value; }
		}
	#endregion
	}
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under A Public Domain dedication


Written By
Technical Lead Artaker Computersysteme GmbH
Austria Austria
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions