Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / wpf / src / Framework / System / Windows / Automation / Peers / ToggleButtonAutomationPeer.cs / 1 / 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; return null; } 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. 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; return null; } 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
- WorkflowElementDialogWindow.xaml.cs
- TableItemPattern.cs
- EntityDesignerDataSourceView.cs
- RectValueSerializer.cs
- IsolationInterop.cs
- Point.cs
- wgx_sdk_version.cs
- DocumentPaginator.cs
- ListItemCollection.cs
- _NestedMultipleAsyncResult.cs
- QueryOutputWriter.cs
- DockPanel.cs
- EditCommandColumn.cs
- SpecialFolderEnumConverter.cs
- CollectionBase.cs
- Normalization.cs
- DemultiplexingDispatchMessageFormatter.cs
- ConsumerConnectionPoint.cs
- SessionStateContainer.cs
- XmlChildNodes.cs
- EncoderExceptionFallback.cs
- MimeParameter.cs
- FolderBrowserDialog.cs
- ACL.cs
- WebBrowser.cs
- FillErrorEventArgs.cs
- ContentElementAutomationPeer.cs
- x509store.cs
- WindowsPen.cs
- DataTrigger.cs
- PersonalizationStateQuery.cs
- BuilderPropertyEntry.cs
- XmlUtf8RawTextWriter.cs
- RepeaterCommandEventArgs.cs
- SqlError.cs
- DbConnectionOptions.cs
- ConstructorBuilder.cs
- DbInsertCommandTree.cs
- DynamicEndpoint.cs
- CodeMemberProperty.cs
- CodeNamespaceImport.cs
- AnnouncementInnerClientCD1.cs
- Menu.cs
- ThreadStateException.cs
- MarkupObject.cs
- InputProcessorProfiles.cs
- Point4DValueSerializer.cs
- TypeSystem.cs
- PublisherMembershipCondition.cs
- BitmapFrameEncode.cs
- KeyNotFoundException.cs
- PassportAuthenticationModule.cs
- ScriptingAuthenticationServiceSection.cs
- ProfileGroupSettings.cs
- DataGridViewRowHeaderCell.cs
- HostingEnvironmentSection.cs
- SQLByteStorage.cs
- ToolStripSystemRenderer.cs
- LZCodec.cs
- SettingsPropertyCollection.cs
- PenThreadWorker.cs
- CharStorage.cs
- StrongNameUtility.cs
- PageWrapper.cs
- FixedHyperLink.cs
- SqlRetyper.cs
- WindowsListViewItemStartMenu.cs
- ObjectAnimationBase.cs
- MessagePropertyAttribute.cs
- ParentQuery.cs
- ViewGenerator.cs
- Rect3D.cs
- PixelFormats.cs
- UniqueIdentifierService.cs
- SetStoryboardSpeedRatio.cs
- Journaling.cs
- StringReader.cs
- CompensatableTransactionScopeActivityDesigner.cs
- coordinatorscratchpad.cs
- ProviderSettingsCollection.cs
- ComponentGlyph.cs
- SubclassTypeValidator.cs
- ChannelManager.cs
- FamilyMap.cs
- DtdParser.cs
- ServiceOperationParameter.cs
- CodeGenerator.cs
- BitmapEffectState.cs
- IntSecurity.cs
- HyperlinkAutomationPeer.cs
- HtmlElementErrorEventArgs.cs
- AppLevelCompilationSectionCache.cs
- PageContentAsyncResult.cs
- SqlDataSourceSummaryPanel.cs
- SqlUserDefinedTypeAttribute.cs
- InertiaTranslationBehavior.cs
- CodeEventReferenceExpression.cs
- ChildrenQuery.cs
- ModifierKeysValueSerializer.cs
- RequiredAttributeAttribute.cs