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
- Color.cs
- CurrentChangingEventManager.cs
- TypeSource.cs
- XmlDataContract.cs
- SoapElementAttribute.cs
- InkCanvasSelectionAdorner.cs
- KeyboardNavigation.cs
- UrlMappingsSection.cs
- AsymmetricSignatureFormatter.cs
- FixedFindEngine.cs
- QueueProcessor.cs
- DocumentCollection.cs
- oledbmetadatacollectionnames.cs
- ClientTargetSection.cs
- GlyphShapingProperties.cs
- __FastResourceComparer.cs
- ToolboxSnapDragDropEventArgs.cs
- InvalidOleVariantTypeException.cs
- DispatcherFrame.cs
- DbgUtil.cs
- TypeLoadException.cs
- XmlUtilWriter.cs
- SplineKeyFrames.cs
- XmlElementList.cs
- AccessText.cs
- SpellerHighlightLayer.cs
- TextFormatterContext.cs
- XmlDocument.cs
- WebPartManager.cs
- DBBindings.cs
- EventListenerClientSide.cs
- UriScheme.cs
- JapaneseLunisolarCalendar.cs
- ColumnResizeAdorner.cs
- RegexCapture.cs
- SaveFileDialog.cs
- securitycriticaldataClass.cs
- TrackingWorkflowEventArgs.cs
- ContainerTracking.cs
- ToolStripContentPanel.cs
- UpDownEvent.cs
- TraceContextRecord.cs
- MaterialCollection.cs
- EncryptedReference.cs
- EventLogger.cs
- DataGridItem.cs
- GPRECT.cs
- AsynchronousChannel.cs
- PersonalizationState.cs
- MessageFault.cs
- FlowLayout.cs
- WindowsIdentity.cs
- SplineKeyFrames.cs
- SynchronizedInputPattern.cs
- Int32KeyFrameCollection.cs
- RunClient.cs
- PropVariant.cs
- Rect3D.cs
- ReachIDocumentPaginatorSerializerAsync.cs
- TextTrailingWordEllipsis.cs
- SwitchLevelAttribute.cs
- ApplicationSecurityInfo.cs
- DriveInfo.cs
- SmtpNetworkElement.cs
- QuaternionAnimation.cs
- util.cs
- DataKeyArray.cs
- ImageIndexEditor.cs
- ThicknessAnimation.cs
- RelationshipEndCollection.cs
- EventLogConfiguration.cs
- StaticExtensionConverter.cs
- Validator.cs
- Bold.cs
- SupportsPreviewControlAttribute.cs
- CodeAttributeArgumentCollection.cs
- DataServiceOperationContext.cs
- DrawingServices.cs
- SerializationInfoEnumerator.cs
- ZoomPercentageConverter.cs
- SystemParameters.cs
- DragDropHelper.cs
- XmlSerializationGeneratedCode.cs
- AuthorizationRule.cs
- TextEffect.cs
- DataObjectPastingEventArgs.cs
- DataGridState.cs
- ToolboxItemImageConverter.cs
- InvalidFilterCriteriaException.cs
- FixedSOMElement.cs
- IndicShape.cs
- MsmqIntegrationSecurityElement.cs
- StateMachine.cs
- TextRangeProviderWrapper.cs
- DbExpressionBuilder.cs
- AsymmetricCryptoHandle.cs
- DbConnectionStringCommon.cs
- IsolatedStorageException.cs
- GPRECT.cs
- SQLBoolean.cs