Code:
/ DotNET / DotNET / 8.0 / untmp / whidbey / REDBITS / ndp / fx / src / Designer / WebForms / System / Web / UI / Design / Util / UnsettableComboBox.cs / 1 / UnsettableComboBox.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- // UnsettableComboBox.cs // // 12/22/98: Created: [....] // namespace System.Web.UI.Design.Util { using System; using System.Design; using System.ComponentModel; using System.Windows.Forms; using System.Diagnostics; using System.Drawing; using System.Web.UI.Design; ////// /// Standard combobox with a "Not Set" item as the first item in its dropdown. /// It also automatically blanks out the "Not Set" item on losing focus. /// ///[System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Demand, Flags=System.Security.Permissions.SecurityPermissionFlag.UnmanagedCode)] internal sealed class UnsettableComboBox : ComboBox { private string notSetText; private bool internalChange; public UnsettableComboBox() { notSetText = SR.GetString(SR.UnsettableComboBox_NotSet); Items.Add(notSetText); } public string NotSetText { get { return notSetText; } set { notSetText = value; Items.RemoveAt(0); Items.Insert(0, notSetText); } } public override string Text { get { if ((this.SelectedIndex == 0) || (this.SelectedIndex == -1)) return String.Empty; else return base.Text; } set { base.Text = value; } } public void AddItem(object item) { Items.Add(item); } public void EnsureNotSetItem() { if (Items.Count == 0) { Items.Add(notSetText); } } public bool IsSet() { return SelectedIndex > 0; } protected override void OnLostFocus(EventArgs e) { base.OnLostFocus(e); if (SelectedIndex == 0) { internalChange = true; SelectedIndex = -1; internalChange = false; } } protected override void OnSelectedIndexChanged(EventArgs e) { if (internalChange == false) { base.OnSelectedIndexChanged(e); } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ProfilePropertySettingsCollection.cs
- SerializationSectionGroup.cs
- DateTimeStorage.cs
- WsatConfiguration.cs
- DataGridViewSelectedCellCollection.cs
- GroupBox.cs
- RepeatBehavior.cs
- QuaternionRotation3D.cs
- WebServiceResponse.cs
- SmtpFailedRecipientsException.cs
- XmlParserContext.cs
- SmiSettersStream.cs
- SignedXml.cs
- HebrewCalendar.cs
- FilterableAttribute.cs
- TimeEnumHelper.cs
- HMAC.cs
- AssemblyName.cs
- GenericXmlSecurityToken.cs
- XmlReflectionMember.cs
- ManagedCodeMarkers.cs
- ProtocolViolationException.cs
- RawUIStateInputReport.cs
- DataGridViewCellStyle.cs
- SequentialOutput.cs
- AuthenticationModuleElementCollection.cs
- TableLayoutSettingsTypeConverter.cs
- HMACSHA256.cs
- OneOfScalarConst.cs
- XmlnsPrefixAttribute.cs
- XPathBinder.cs
- XhtmlBasicTextViewAdapter.cs
- ConstantProjectedSlot.cs
- SoapProtocolReflector.cs
- JsonFormatWriterGenerator.cs
- DataKey.cs
- InlineObject.cs
- ContainerFilterService.cs
- ConfigurationLocationCollection.cs
- DesignBinding.cs
- ApplicationServiceManager.cs
- AutomationIdentifierGuids.cs
- Symbol.cs
- GlyphRun.cs
- ParentQuery.cs
- Point3DAnimation.cs
- ResXResourceWriter.cs
- InstanceOwner.cs
- FormDocumentDesigner.cs
- HyperLinkStyle.cs
- FtpWebResponse.cs
- TailCallAnalyzer.cs
- BackgroundWorker.cs
- GridViewDeleteEventArgs.cs
- DependencyProperty.cs
- LineServicesRun.cs
- Vector3DCollectionConverter.cs
- ToolStripRenderer.cs
- SystemMulticastIPAddressInformation.cs
- ComponentChangedEvent.cs
- WizardStepBase.cs
- DesignerActionTextItem.cs
- InstallHelper.cs
- PrintController.cs
- UIElementAutomationPeer.cs
- KeyNotFoundException.cs
- MembershipPasswordException.cs
- CodeAttributeArgumentCollection.cs
- CultureInfo.cs
- SmtpSection.cs
- File.cs
- RuleSettingsCollection.cs
- HtmlDocument.cs
- CodeTryCatchFinallyStatement.cs
- ValueTable.cs
- ComboBoxAutomationPeer.cs
- PermissionToken.cs
- DataGridSortCommandEventArgs.cs
- CollectionViewProxy.cs
- ChannelManagerHelpers.cs
- DelayedRegex.cs
- IsolatedStorage.cs
- SourceInterpreter.cs
- ReflectionTypeLoadException.cs
- GroupQuery.cs
- EventBuilder.cs
- AttributeData.cs
- ConfigurationManagerHelper.cs
- Variable.cs
- GlyphInfoList.cs
- ListManagerBindingsCollection.cs
- ObjectStateManagerMetadata.cs
- StylusDownEventArgs.cs
- TemplateBindingExpressionConverter.cs
- ConnectionManagementElementCollection.cs
- SchemaNotation.cs
- X509Certificate2Collection.cs
- RectangleConverter.cs
- Paragraph.cs
- BevelBitmapEffect.cs