Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / Orcas / QFE / 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
- DeviceContext.cs
- PeerCollaborationPermission.cs
- Encoding.cs
- ErrorWrapper.cs
- NullableLongSumAggregationOperator.cs
- DbBuffer.cs
- XPathChildIterator.cs
- DataGridItemAutomationPeer.cs
- HostExecutionContextManager.cs
- BCLDebug.cs
- KeyGestureValueSerializer.cs
- RangeContentEnumerator.cs
- DocumentSchemaValidator.cs
- latinshape.cs
- PiiTraceSource.cs
- OleDbConnectionInternal.cs
- NativeMethods.cs
- AspNetHostingPermission.cs
- OracleConnectionStringBuilder.cs
- AudioException.cs
- SplitContainer.cs
- MemberInfoSerializationHolder.cs
- AggregateNode.cs
- EntityCollection.cs
- PackagePartCollection.cs
- WsdlBuildProvider.cs
- webbrowsersite.cs
- SpeechRecognizer.cs
- wgx_sdk_version.cs
- WebPartMenu.cs
- TabControl.cs
- EntityViewContainer.cs
- WorkflowApplicationAbortedEventArgs.cs
- HttpCacheParams.cs
- ExpressionServices.cs
- DbConnectionStringCommon.cs
- CodeLinePragma.cs
- PersonalizationState.cs
- IntSecurity.cs
- StringFunctions.cs
- MemberAssignmentAnalysis.cs
- ResourceFallbackManager.cs
- ToolStripDropDownClosingEventArgs.cs
- PingOptions.cs
- ServiceParser.cs
- TextContainer.cs
- RayHitTestParameters.cs
- KeyValuePair.cs
- HttpInputStream.cs
- Range.cs
- TypeUnloadedException.cs
- Button.cs
- DoubleAnimationClockResource.cs
- CookielessHelper.cs
- UnionExpr.cs
- ADRoleFactory.cs
- DesignObjectWrapper.cs
- BindingNavigatorDesigner.cs
- MobileCategoryAttribute.cs
- SafeViewOfFileHandle.cs
- IdentityModelStringsVersion1.cs
- ChtmlPhoneCallAdapter.cs
- AssociationSetMetadata.cs
- FixedFindEngine.cs
- SmtpSpecifiedPickupDirectoryElement.cs
- DetailsViewRow.cs
- OracleTimeSpan.cs
- TraceHandler.cs
- OutputScope.cs
- ConfigurationSection.cs
- XmlWriterDelegator.cs
- ImageInfo.cs
- Baml6Assembly.cs
- WebPartDisplayModeCancelEventArgs.cs
- Substitution.cs
- ParameterCollection.cs
- HttpListenerTimeoutManager.cs
- TableRowGroup.cs
- LookupNode.cs
- SelectedDatesCollection.cs
- BindingSourceDesigner.cs
- TableLayoutPanelCellPosition.cs
- AnimationTimeline.cs
- HttpCapabilitiesBase.cs
- ScaleTransform3D.cs
- MailMessage.cs
- XmlEventCache.cs
- Journal.cs
- Page.cs
- ZoneLinkButton.cs
- HealthMonitoringSection.cs
- VirtualPathUtility.cs
- ChildTable.cs
- _LocalDataStore.cs
- HostedElements.cs
- FormViewInsertedEventArgs.cs
- Process.cs
- FieldBuilder.cs
- compensatingcollection.cs
- FontFamilyConverter.cs