Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / MIT / System / Web / UI / MobileControls / Design / Util / UnsettableComboBox.cs / 1305376 / UnsettableComboBox.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Web.UI.Design.MobileControls.Util { using System; using System.Collections; using System.ComponentModel; using System.Diagnostics; using System.Drawing; using System.Windows.Forms; // 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) ] [Obsolete("The System.Web.Mobile.dll assembly has been deprecated and should no longer be used. For information about how to develop ASP.NET mobile applications, see http://go.microsoft.com/fwlink/?LinkId=157231.")] internal class UnsettableComboBox : ComboBox { private String notSetText; private String notSetCompactText; internal UnsettableComboBox() { notSetText = SR.GetString(SR.UnsettableComboBox_NotSetText); notSetCompactText = SR.GetString(SR.UnsettableComboBox_NotSetCompactText); } internal String NotSetText { get { return notSetText; } set { notSetText = value; } } internal String NotSetCompactText { get { return notSetCompactText; } set { notSetCompactText = value; } } public override String Text { get { // handle DropDown styles in Templating Options dialog // if (this.SelectedIndex == 0) || (this.SelectedIndex == -1)) if (this.SelectedIndex == 0) { return String.Empty; } else { return base.Text; } } set { if (value == notSetCompactText) { base.Text = String.Empty; } else { base.Text = value; } } } internal void AddItem(Object item) { EnsureNotSetItem(); Items.Add(item); } internal void EnsureNotSetItem() { if (Items.Count == 0) { Items.Add(notSetText); } } #if UNUSED_CODE internal bool IsSet() { return SelectedIndex > 0; } #endif protected override void OnLostFocus(EventArgs e) { base.OnLostFocus(e); if (SelectedIndex == 0) { SelectedIndex = -1; } } protected override void SetItemsCore(IList values) { Items.Clear(); if (!DesignMode) { Items.Add(notSetText); } // Unfortunately. the interfaces between SetItemsCore and // AddItemsCore are mismatched as of 3106. ArrayList items = new ArrayList(); foreach(Object item in values) { items.Add(item); } base.AddItemsCore(items.ToArray()); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Web.UI.Design.MobileControls.Util { using System; using System.Collections; using System.ComponentModel; using System.Diagnostics; using System.Drawing; using System.Windows.Forms; // 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) ] [Obsolete("The System.Web.Mobile.dll assembly has been deprecated and should no longer be used. For information about how to develop ASP.NET mobile applications, see http://go.microsoft.com/fwlink/?LinkId=157231.")] internal class UnsettableComboBox : ComboBox { private String notSetText; private String notSetCompactText; internal UnsettableComboBox() { notSetText = SR.GetString(SR.UnsettableComboBox_NotSetText); notSetCompactText = SR.GetString(SR.UnsettableComboBox_NotSetCompactText); } internal String NotSetText { get { return notSetText; } set { notSetText = value; } } internal String NotSetCompactText { get { return notSetCompactText; } set { notSetCompactText = value; } } public override String Text { get { // handle DropDown styles in Templating Options dialog // if (this.SelectedIndex == 0) || (this.SelectedIndex == -1)) if (this.SelectedIndex == 0) { return String.Empty; } else { return base.Text; } } set { if (value == notSetCompactText) { base.Text = String.Empty; } else { base.Text = value; } } } internal void AddItem(Object item) { EnsureNotSetItem(); Items.Add(item); } internal void EnsureNotSetItem() { if (Items.Count == 0) { Items.Add(notSetText); } } #if UNUSED_CODE internal bool IsSet() { return SelectedIndex > 0; } #endif protected override void OnLostFocus(EventArgs e) { base.OnLostFocus(e); if (SelectedIndex == 0) { SelectedIndex = -1; } } protected override void SetItemsCore(IList values) { Items.Clear(); if (!DesignMode) { Items.Add(notSetText); } // Unfortunately. the interfaces between SetItemsCore and // AddItemsCore are mismatched as of 3106. ArrayList items = new ArrayList(); foreach(Object item in values) { items.Add(item); } base.AddItemsCore(items.ToArray()); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu
![Network programming in C#, Network Programming in VB.NET, Network Programming in .NET](/images/book.jpg)
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- XPathAncestorIterator.cs
- HtmlContainerControl.cs
- smtppermission.cs
- Dictionary.cs
- SoapUnknownHeader.cs
- StructuredCompositeActivityDesigner.cs
- DesignTimeXamlWriter.cs
- AttributeEmitter.cs
- WebPartDisplayModeEventArgs.cs
- ProtocolsConfigurationHandler.cs
- BamlResourceDeserializer.cs
- Win32KeyboardDevice.cs
- OleDbStruct.cs
- StorageEntityContainerMapping.cs
- ADMembershipUser.cs
- ChangeNode.cs
- DtdParser.cs
- ViewStateException.cs
- RowParagraph.cs
- DummyDataSource.cs
- SafeNativeMethods.cs
- CLRBindingWorker.cs
- SystemInfo.cs
- ValidatorCompatibilityHelper.cs
- WebPartActionVerb.cs
- HealthMonitoringSectionHelper.cs
- HandlerWithFactory.cs
- DrawingContext.cs
- ToolStripDesignerAvailabilityAttribute.cs
- WebServiceHostFactory.cs
- DesignerDataConnection.cs
- UIElement.cs
- SqlCharStream.cs
- WebPartAuthorizationEventArgs.cs
- EmbeddedMailObject.cs
- AuthorizationRule.cs
- coordinator.cs
- AxisAngleRotation3D.cs
- TreeNodeMouseHoverEvent.cs
- WpfPayload.cs
- StackBuilderSink.cs
- PartialToken.cs
- EmbossBitmapEffect.cs
- SamlAssertion.cs
- DesignerDataTableBase.cs
- WindowsFormsHost.cs
- ListItemCollection.cs
- XmlSchemaExternal.cs
- ReplacementText.cs
- FormatterConverter.cs
- SingleAnimationUsingKeyFrames.cs
- DesignBindingPicker.cs
- RegexTree.cs
- DataServiceSaveChangesEventArgs.cs
- figurelengthconverter.cs
- MapPathBasedVirtualPathProvider.cs
- TextPattern.cs
- SmiEventStream.cs
- AttachedAnnotationChangedEventArgs.cs
- MenuItem.cs
- CalendarDay.cs
- CompiledIdentityConstraint.cs
- ApplicationDirectoryMembershipCondition.cs
- WebDescriptionAttribute.cs
- DesignerVerbCollection.cs
- ArrayList.cs
- QueryPageSettingsEventArgs.cs
- TimeEnumHelper.cs
- InvalidPropValue.cs
- NextPreviousPagerField.cs
- WorkflowEventArgs.cs
- MergeLocalizationDirectives.cs
- ApplicationSecurityManager.cs
- NullReferenceException.cs
- InvalidOleVariantTypeException.cs
- DeflateEmulationStream.cs
- FileLogRecordHeader.cs
- SessionParameter.cs
- ThemeInfoAttribute.cs
- TreeViewDataItemAutomationPeer.cs
- SectionInformation.cs
- Size3D.cs
- EdmRelationshipNavigationPropertyAttribute.cs
- UxThemeWrapper.cs
- EntityEntry.cs
- CatalogZone.cs
- FaultHandlingFilter.cs
- DataGridViewCellEventArgs.cs
- DocumentCollection.cs
- ObjectDisposedException.cs
- DoubleAnimationUsingKeyFrames.cs
- CopyOnWriteList.cs
- SinglePageViewer.cs
- PassportIdentity.cs
- StrongNameKeyPair.cs
- SemanticAnalyzer.cs
- DropAnimation.xaml.cs
- RequestBringIntoViewEventArgs.cs
- FileVersionInfo.cs
- QueryStack.cs