Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / wpf / src / Framework / System / Windows / Automation / Peers / ExpanderAutomationPeer.cs / 1305600 / ExpanderAutomationPeer.cs
using System; using System.Collections; using System.Collections.Generic; 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 ExpanderAutomationPeer : FrameworkElementAutomationPeer, IExpandCollapseProvider { /// public ExpanderAutomationPeer(Expander owner): base(owner) {} /// override protected string GetClassNameCore() { return "Expander"; } /// override protected AutomationControlType GetAutomationControlTypeCore() { return AutomationControlType.Group; } /// override public object GetPattern(PatternInterface pattern) { object iface = null; if(pattern == PatternInterface.ExpandCollapse) { iface = this; } else { iface = base.GetPattern(pattern); } return iface; } #region ExpandCollapse ////// Blocking method that returns after the element has been expanded. /// ///true if the node was successfully expanded void IExpandCollapseProvider.Expand() { if (!IsEnabled()) throw new ElementNotEnabledException(); Expander owner = (Expander)((ExpanderAutomationPeer)this).Owner; owner.IsExpanded = true; } ////// Blocking method that returns after the element has been collapsed. /// ///true if the node was successfully collapsed void IExpandCollapseProvider.Collapse() { if (!IsEnabled()) throw new ElementNotEnabledException(); Expander owner = (Expander)((ExpanderAutomationPeer)this).Owner; owner.IsExpanded = false; } ///indicates an element's current Collapsed or Expanded state ExpandCollapseState IExpandCollapseProvider.ExpandCollapseState { get { Expander owner = (Expander)((ExpanderAutomationPeer)this).Owner; return owner.IsExpanded ? ExpandCollapseState.Expanded : ExpandCollapseState.Collapsed; } } // [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)] internal void RaiseExpandCollapseAutomationEvent(bool oldValue, bool newValue) { RaisePropertyChangedEvent( ExpandCollapsePatternIdentifiers.ExpandCollapseStateProperty, oldValue ? ExpandCollapseState.Expanded : ExpandCollapseState.Collapsed, newValue ? ExpandCollapseState.Expanded : ExpandCollapseState.Collapsed); } #endregion ExpandCollapse } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved. using System; using System.Collections; using System.Collections.Generic; 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 ExpanderAutomationPeer : FrameworkElementAutomationPeer, IExpandCollapseProvider { /// public ExpanderAutomationPeer(Expander owner): base(owner) {} /// override protected string GetClassNameCore() { return "Expander"; } /// override protected AutomationControlType GetAutomationControlTypeCore() { return AutomationControlType.Group; } /// override public object GetPattern(PatternInterface pattern) { object iface = null; if(pattern == PatternInterface.ExpandCollapse) { iface = this; } else { iface = base.GetPattern(pattern); } return iface; } #region ExpandCollapse ////// Blocking method that returns after the element has been expanded. /// ///true if the node was successfully expanded void IExpandCollapseProvider.Expand() { if (!IsEnabled()) throw new ElementNotEnabledException(); Expander owner = (Expander)((ExpanderAutomationPeer)this).Owner; owner.IsExpanded = true; } ////// Blocking method that returns after the element has been collapsed. /// ///true if the node was successfully collapsed void IExpandCollapseProvider.Collapse() { if (!IsEnabled()) throw new ElementNotEnabledException(); Expander owner = (Expander)((ExpanderAutomationPeer)this).Owner; owner.IsExpanded = false; } ///indicates an element's current Collapsed or Expanded state ExpandCollapseState IExpandCollapseProvider.ExpandCollapseState { get { Expander owner = (Expander)((ExpanderAutomationPeer)this).Owner; return owner.IsExpanded ? ExpandCollapseState.Expanded : ExpandCollapseState.Collapsed; } } // [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)] internal void RaiseExpandCollapseAutomationEvent(bool oldValue, bool newValue) { RaisePropertyChangedEvent( ExpandCollapsePatternIdentifiers.ExpandCollapseStateProperty, oldValue ? ExpandCollapseState.Expanded : ExpandCollapseState.Collapsed, newValue ? ExpandCollapseState.Expanded : ExpandCollapseState.Collapsed); } #endregion ExpandCollapse } } // 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
- AccessDataSourceView.cs
- HtmlControlPersistable.cs
- ReferenceTypeElement.cs
- HttpProfileBase.cs
- AndAlso.cs
- Table.cs
- ProcessHostConfigUtils.cs
- URI.cs
- WindowsPrincipal.cs
- CommandID.cs
- ObjectStateEntryOriginalDbUpdatableDataRecord.cs
- PartManifestEntry.cs
- SizeFConverter.cs
- NetworkCredential.cs
- Query.cs
- CodeObject.cs
- DirectionalLight.cs
- TrustLevel.cs
- SQLCharsStorage.cs
- SiteMapPath.cs
- DataReaderContainer.cs
- XmlReturnWriter.cs
- smtpconnection.cs
- ReadOnlyHierarchicalDataSourceView.cs
- unsafenativemethodstextservices.cs
- XamlClipboardData.cs
- FormCollection.cs
- SiteMapDataSource.cs
- DetailsViewPageEventArgs.cs
- DataListAutoFormat.cs
- Base64Encoder.cs
- MouseEvent.cs
- ReferentialConstraint.cs
- Sequence.cs
- DocobjHost.cs
- EventHandlerList.cs
- SoapTransportImporter.cs
- FixedLineResult.cs
- ButtonField.cs
- HwndHostAutomationPeer.cs
- SqlWriter.cs
- SettingsContext.cs
- DataGridViewHeaderCell.cs
- LineUtil.cs
- sqlinternaltransaction.cs
- ExtendedTransformFactory.cs
- TableColumn.cs
- ServiceInstallComponent.cs
- FileClassifier.cs
- ReadOnlyHierarchicalDataSource.cs
- CellTreeNode.cs
- NumericUpDown.cs
- Shape.cs
- CalendarModeChangedEventArgs.cs
- OleDbInfoMessageEvent.cs
- StringResourceManager.cs
- SplineKeyFrames.cs
- CollectionConverter.cs
- TextBoxLine.cs
- AsyncMethodInvoker.cs
- HtmlEmptyTagControlBuilder.cs
- InputProcessorProfiles.cs
- ImageSource.cs
- SqlSelectStatement.cs
- Context.cs
- DateTimePicker.cs
- CharAnimationBase.cs
- GlyphInfoList.cs
- ServicePointManagerElement.cs
- BlurEffect.cs
- NameScopePropertyAttribute.cs
- ProgressBarBrushConverter.cs
- ZeroOpNode.cs
- SecureEnvironment.cs
- BrowserTree.cs
- DesignTimeParseData.cs
- TagMapCollection.cs
- GacUtil.cs
- PersonalizationStateInfo.cs
- WebPageTraceListener.cs
- ValueTypeFixupInfo.cs
- SpecialNameAttribute.cs
- TreeView.cs
- WebPartCancelEventArgs.cs
- TypeSystem.cs
- ArraySortHelper.cs
- DataTable.cs
- ResourceExpressionBuilder.cs
- LayoutEditorPart.cs
- ProcessModule.cs
- ListItemsCollectionEditor.cs
- ServiceParser.cs
- XmlSchemaInfo.cs
- DockingAttribute.cs
- SerializationAttributes.cs
- XslVisitor.cs
- TextParentUndoUnit.cs
- NetMsmqSecurityMode.cs
- SapiGrammar.cs
- SystemIPv6InterfaceProperties.cs