Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / wpf / src / Framework / System / Windows / Automation / Peers / ToggleButtonAutomationPeer.cs / 1305600 / ToggleButtonAutomationPeer.cs
using System; using System.Runtime.InteropServices; using System.Security; using System.Text; using System.Windows; using System.Windows.Automation.Provider; using System.Windows.Controls; using System.Windows.Controls.Primitives; using System.Windows.Interop; using System.Windows.Media; using MS.Internal; using MS.Win32; namespace System.Windows.Automation.Peers { /// public class ToggleButtonAutomationPeer : ButtonBaseAutomationPeer, IToggleProvider { /// public ToggleButtonAutomationPeer(ToggleButton owner): base(owner) {} /// override protected string GetClassNameCore() { return "Button"; } /// override protected AutomationControlType GetAutomationControlTypeCore() { return AutomationControlType.Button; } /// override public object GetPattern(PatternInterface patternInterface) { if (patternInterface == PatternInterface.Toggle) { return this; } else { return base.GetPattern(patternInterface); } } void IToggleProvider.Toggle() { if(!IsEnabled()) throw new ElementNotEnabledException(); ToggleButton owner = (ToggleButton)Owner; owner.OnToggle(); } ToggleState IToggleProvider.ToggleState { get { ToggleButton owner = (ToggleButton)Owner; return ConvertToToggleState(owner.IsChecked); } } // [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)] internal virtual void RaiseToggleStatePropertyChangedEvent(bool? oldValue, bool? newValue) { if (oldValue != newValue) { RaisePropertyChangedEvent(TogglePatternIdentifiers.ToggleStateProperty, ConvertToToggleState(oldValue), ConvertToToggleState(newValue)); } } private static ToggleState ConvertToToggleState(bool? value) { switch (value) { case (true): return ToggleState.On; case (false): return ToggleState.Off; default: return ToggleState.Indeterminate; } } } } // 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
- PathSegmentCollection.cs
- UTF8Encoding.cs
- ProfileGroupSettings.cs
- View.cs
- CommonObjectSecurity.cs
- SqlClientMetaDataCollectionNames.cs
- TypeReference.cs
- counter.cs
- DataServiceQuery.cs
- VectorValueSerializer.cs
- ToolboxCategory.cs
- SchemaCollectionPreprocessor.cs
- GeneralTransform2DTo3DTo2D.cs
- Activity.cs
- HWStack.cs
- SafeLibraryHandle.cs
- X509Certificate.cs
- TransformFinalBlockRequest.cs
- BuildProvider.cs
- StreamInfo.cs
- AssemblyAttributes.cs
- CutCopyPasteHelper.cs
- CodeDelegateInvokeExpression.cs
- TeredoHelper.cs
- ReaderContextStackData.cs
- HTTP_SERVICE_CONFIG_URLACL_PARAM.cs
- ByteStack.cs
- StringUtil.cs
- SqlBinder.cs
- RowTypePropertyElement.cs
- BindingContext.cs
- TabPage.cs
- DataGridItemAttachedStorage.cs
- NeutralResourcesLanguageAttribute.cs
- RegexMatch.cs
- PageParser.cs
- WindowsHyperlink.cs
- ConfigXmlElement.cs
- ManifestSignatureInformation.cs
- GridEntryCollection.cs
- UrlMappingsModule.cs
- LinkLabelLinkClickedEvent.cs
- PartialList.cs
- TableSectionStyle.cs
- QilXmlWriter.cs
- M3DUtil.cs
- RemoteWebConfigurationHostServer.cs
- COM2FontConverter.cs
- ReadOnlyActivityGlyph.cs
- TableRowGroupCollection.cs
- GeneralTransform.cs
- ListBox.cs
- CodeDelegateInvokeExpression.cs
- ImageMapEventArgs.cs
- ComponentChangedEvent.cs
- DateTimeUtil.cs
- MenuItemStyle.cs
- State.cs
- GB18030Encoding.cs
- TranslateTransform3D.cs
- DBBindings.cs
- PermissionAttributes.cs
- KnownBoxes.cs
- TableLayoutPanelCodeDomSerializer.cs
- MimeTypePropertyAttribute.cs
- FilterableAttribute.cs
- RC2.cs
- FuncCompletionCallbackWrapper.cs
- DataObjectMethodAttribute.cs
- SqlConnectionHelper.cs
- ProxyWebPartManager.cs
- SerializationEventsCache.cs
- LostFocusEventManager.cs
- Speller.cs
- DynamicExpression.cs
- SmiMetaDataProperty.cs
- DetailsView.cs
- ProcessHostServerConfig.cs
- MetadataHelper.cs
- MergePropertyDescriptor.cs
- ChangeInterceptorAttribute.cs
- CallbackHandler.cs
- MailSettingsSection.cs
- ExpressionNode.cs
- TextFormatterHost.cs
- SerTrace.cs
- DataGridHeaderBorder.cs
- ByeMessageApril2005.cs
- _SecureChannel.cs
- ManipulationCompletedEventArgs.cs
- ProtectedProviderSettings.cs
- TreeSet.cs
- isolationinterop.cs
- COM2FontConverter.cs
- StylusPointCollection.cs
- LoaderAllocator.cs
- PublisherMembershipCondition.cs
- SqlStream.cs
- iisPickupDirectory.cs
- CssTextWriter.cs