Code:
/ FX-1434 / FX-1434 / 1.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
- Module.cs
- ColorTransform.cs
- ServiceOperationParameter.cs
- Annotation.cs
- Error.cs
- HttpContext.cs
- MobileControlBuilder.cs
- HwndTarget.cs
- MenuRendererClassic.cs
- BaseComponentEditor.cs
- DataTableReaderListener.cs
- ContentValidator.cs
- BooleanAnimationUsingKeyFrames.cs
- InstallerTypeAttribute.cs
- FromRequest.cs
- DataContract.cs
- PersistenceException.cs
- util.cs
- CoreSwitches.cs
- AuthStoreRoleProvider.cs
- CompositeActivityTypeDescriptorProvider.cs
- RowVisual.cs
- IndentedTextWriter.cs
- _FtpControlStream.cs
- HotSpot.cs
- DataGridViewCellMouseEventArgs.cs
- _LazyAsyncResult.cs
- StylusDevice.cs
- WebServiceClientProxyGenerator.cs
- BinaryReader.cs
- TargetConverter.cs
- LicenseManager.cs
- TextRenderingModeValidation.cs
- DiscoveryClientRequestChannel.cs
- PickDesigner.xaml.cs
- GCHandleCookieTable.cs
- PriorityQueue.cs
- BulletChrome.cs
- ParameterExpression.cs
- DataGridViewBand.cs
- Util.cs
- UnmanagedMemoryStream.cs
- ReadOnlyHierarchicalDataSourceView.cs
- PassportIdentity.cs
- SecondaryIndexList.cs
- TrustManagerMoreInformation.cs
- XmlNavigatorStack.cs
- WebUtil.cs
- SessionStateSection.cs
- Geometry.cs
- DynamicResourceExtension.cs
- XmlDictionaryString.cs
- EventPrivateKey.cs
- MetabaseServerConfig.cs
- BindingExpressionBase.cs
- EntityException.cs
- GridViewUpdateEventArgs.cs
- AccessibleObject.cs
- FixedDSBuilder.cs
- ExceptionWrapper.cs
- CommandExpr.cs
- Formatter.cs
- HtmlTableCellCollection.cs
- CompilerResults.cs
- Label.cs
- HtmlSelect.cs
- ErrorEventArgs.cs
- QilDataSource.cs
- precedingquery.cs
- WriteTimeStream.cs
- MessageHeaderT.cs
- PackagePart.cs
- TableRow.cs
- SemanticBasicElement.cs
- SystemUdpStatistics.cs
- UIElement.cs
- AnnotationAdorner.cs
- ErrorsHelper.cs
- XslUrlEditor.cs
- WindowsRichEdit.cs
- DataContext.cs
- ListenerChannelContext.cs
- DuplexChannelBinder.cs
- SystemWebCachingSectionGroup.cs
- MenuEventArgs.cs
- XmlDataLoader.cs
- DrawingContextDrawingContextWalker.cs
- IsolatedStorage.cs
- cookieexception.cs
- RbTree.cs
- C14NUtil.cs
- Matrix3DValueSerializer.cs
- ObjectHelper.cs
- AncillaryOps.cs
- DoubleUtil.cs
- ReflectionTypeLoadException.cs
- DrawingServices.cs
- versioninfo.cs
- CodeActivityMetadata.cs
- XmlSchemaAny.cs