Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / Orcas / NetFXw7 / 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
- SQLDecimal.cs
- ScrollProviderWrapper.cs
- SubMenuStyle.cs
- TextOptionsInternal.cs
- ListContractAdapter.cs
- PolyQuadraticBezierSegment.cs
- datacache.cs
- XmlBinaryWriter.cs
- ToolStripRenderer.cs
- EventLogEntryCollection.cs
- ProxyGenerationError.cs
- ButtonChrome.cs
- GroupQuery.cs
- TaiwanLunisolarCalendar.cs
- ParallelTimeline.cs
- ConfigurationPermission.cs
- DbConnectionFactory.cs
- ToolStripSplitButton.cs
- VariableAction.cs
- HttpCapabilitiesEvaluator.cs
- SendMessageContent.cs
- SettingsPropertyNotFoundException.cs
- controlskin.cs
- typedescriptorpermissionattribute.cs
- SrgsRulesCollection.cs
- XmlEncoding.cs
- BrowserDefinitionCollection.cs
- CommandDesigner.cs
- BitmapEffectInputData.cs
- ListBoxAutomationPeer.cs
- AutomationElementCollection.cs
- ListBoxItem.cs
- BinaryParser.cs
- CodeCastExpression.cs
- PrintController.cs
- SmiEventStream.cs
- GridViewRowEventArgs.cs
- DesignSurfaceCollection.cs
- ItemsChangedEventArgs.cs
- SafeNativeMethodsCLR.cs
- CompoundFileStorageReference.cs
- DecimalAnimationUsingKeyFrames.cs
- Win32MouseDevice.cs
- BrowserCapabilitiesFactoryBase.cs
- XmlValidatingReader.cs
- ToolStripActionList.cs
- VectorCollectionConverter.cs
- AssemblyName.cs
- MsmqIntegrationSecurityMode.cs
- PropertyGridEditorPart.cs
- UpWmlPageAdapter.cs
- SamlAuthenticationStatement.cs
- FormViewRow.cs
- CngProperty.cs
- PerformanceCounter.cs
- DropShadowEffect.cs
- DesignUtil.cs
- CodeMemberMethod.cs
- Module.cs
- SqlStatistics.cs
- HyperLinkField.cs
- VisualStyleTypesAndProperties.cs
- StateMachine.cs
- HandleExceptionArgs.cs
- ContractInferenceHelper.cs
- TextWriterTraceListener.cs
- HtmlAnchor.cs
- RepeaterItemEventArgs.cs
- SafeNativeMethods.cs
- _NestedMultipleAsyncResult.cs
- HttpProfileGroupBase.cs
- Rotation3DKeyFrameCollection.cs
- CodeDomSerializerException.cs
- PerspectiveCamera.cs
- DbExpressionVisitor.cs
- PropertyValueChangedEvent.cs
- ComponentConverter.cs
- FileNotFoundException.cs
- X509Certificate.cs
- SQLInt16.cs
- Visitor.cs
- SspiHelper.cs
- AesManaged.cs
- FormatterConverter.cs
- WinFormsSpinner.cs
- SymbolEqualComparer.cs
- FixedSOMElement.cs
- XmlCountingReader.cs
- GridToolTip.cs
- VirtualDirectoryMappingCollection.cs
- DataGridViewSelectedColumnCollection.cs
- PlanCompiler.cs
- IChannel.cs
- ETagAttribute.cs
- XmlSchemaExporter.cs
- RowSpanVector.cs
- OdbcConnectionHandle.cs
- SingleAnimation.cs
- SQLStringStorage.cs
- StrokeNodeEnumerator.cs