Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / wpf / src / Framework / System / Windows / Automation / Peers / DataGridColumnHeaderItemAutomationPeer.cs / 1305600 / DataGridColumnHeaderItemAutomationPeer.cs
using System; using System.Collections.Generic; using System.ComponentModel; using System.Windows; using System.Windows.Automation; using System.Windows.Automation.Provider; using System.Windows.Controls; using System.Windows.Controls.Primitives; using System.Windows.Data; namespace System.Windows.Automation.Peers { ////// Automation Peer for DataGridHeader /// public class DataGridColumnHeaderItemAutomationPeer : ItemAutomationPeer, IInvokeProvider, IScrollItemProvider, ITransformProvider, IVirtualizedItemProvider { public DataGridColumnHeaderItemAutomationPeer(object item, DataGridColumn column, DataGridColumnHeadersPresenterAutomationPeer peer) :base(item, peer) { _column = column; } #region AutomationPeer Overrides ////// Gets the control type for the element that is associated with the UI Automation peer. /// ///The control type. protected override AutomationControlType GetAutomationControlTypeCore() { return AutomationControlType.HeaderItem; } ////// Called by GetClassName that gets a human readable name that, in addition to AutomationControlType, /// differentiates the control represented by this AutomationPeer. /// ///The string that contains the name. protected override string GetClassNameCore() { AutomationPeer wrapperPeer = GetWrapperPeer(); if (wrapperPeer != null) { return wrapperPeer.GetClassName(); } else { ThrowElementNotAvailableException(); } return String.Empty; } ////// Gets the control pattern that is associated with the specified System.Windows.Automation.Peers.PatternInterface. /// /// A value from the System.Windows.Automation.Peers.PatternInterface enumeration. ///The object that supports the specified pattern, or null if unsupported. public override object GetPattern(PatternInterface patternInterface) { switch (patternInterface) { case PatternInterface.Invoke: { if (Column != null && Column.CanUserSort) { return this; } break; } case PatternInterface.ScrollItem: { if (Column != null) { return this; } break; } case PatternInterface.Transform: { if (Column != null && Column.CanUserResize) { return this; } break; } case PatternInterface.VirtualizedItem: { if (Column != null) { return this; } break; } } return null; } ////// Gets a value that specifies whether the element is a content element. /// ///true if the element is a content element; otherwise false protected override bool IsContentElementCore() { return false; } #endregion #region IInvokeProvider void IInvokeProvider.Invoke() { UIElementAutomationPeer wrapperPeer = GetWrapperPeer() as UIElementAutomationPeer; if (wrapperPeer != null) { ((DataGridColumnHeader)wrapperPeer.Owner).Invoke(); } else ThrowElementNotAvailableException(); } #endregion #region IScrollItemProvider void IScrollItemProvider.ScrollIntoView() { if (Column != null && this.OwningDataGrid != null) { this.OwningDataGrid.ScrollIntoView(null, Column); } } #endregion #region ITransformProvider bool ITransformProvider.CanMove { get { return false; } } bool ITransformProvider.CanResize { get { if (this.Column != null) return Column.CanUserResize; return false; } } bool ITransformProvider.CanRotate { get { return false; } } void ITransformProvider.Move(double x, double y) { throw new InvalidOperationException(SR.Get(SRID.DataGridColumnHeaderItemAutomationPeer_Unsupported)); } void ITransformProvider.Resize(double width, double height) { if (this.OwningDataGrid != null && Column.CanUserResize) { Column.Width = new DataGridLength(width); } else { throw new InvalidOperationException(SR.Get(SRID.DataGridColumnHeaderItemAutomationPeer_Unresizable)); } } void ITransformProvider.Rotate(double degrees) { throw new InvalidOperationException(SR.Get(SRID.DataGridColumnHeaderItemAutomationPeer_Unsupported)); } #endregion #region IVirtualizedItemProvider void IVirtualizedItemProvider.Realize() { if (this.OwningDataGrid != null) OwningDataGrid.ScrollIntoView(null,Column); } #endregion #region Properties internal override bool AncestorsInvalid { get { return base.AncestorsInvalid; } set { base.AncestorsInvalid = value; if (value) return; AutomationPeer wrapperPeer = OwningColumnHeaderPeer; if (wrapperPeer != null) { wrapperPeer.AncestorsInvalid = false; } } } internal DataGridColumnHeader OwningHeader { get { return GetWrapper() as DataGridColumnHeader; } } internal DataGrid OwningDataGrid { get { return Column.DataGridOwner; } } internal DataGridColumn Column { get { return _column; } } internal DataGridColumnHeaderAutomationPeer OwningColumnHeaderPeer { get { return GetWrapperPeer() as DataGridColumnHeaderAutomationPeer; } } #endregion #region Private Variables DataGridColumn _column; #endregion } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved. using System; using System.Collections.Generic; using System.ComponentModel; using System.Windows; using System.Windows.Automation; using System.Windows.Automation.Provider; using System.Windows.Controls; using System.Windows.Controls.Primitives; using System.Windows.Data; namespace System.Windows.Automation.Peers { ////// Automation Peer for DataGridHeader /// public class DataGridColumnHeaderItemAutomationPeer : ItemAutomationPeer, IInvokeProvider, IScrollItemProvider, ITransformProvider, IVirtualizedItemProvider { public DataGridColumnHeaderItemAutomationPeer(object item, DataGridColumn column, DataGridColumnHeadersPresenterAutomationPeer peer) :base(item, peer) { _column = column; } #region AutomationPeer Overrides ////// Gets the control type for the element that is associated with the UI Automation peer. /// ///The control type. protected override AutomationControlType GetAutomationControlTypeCore() { return AutomationControlType.HeaderItem; } ////// Called by GetClassName that gets a human readable name that, in addition to AutomationControlType, /// differentiates the control represented by this AutomationPeer. /// ///The string that contains the name. protected override string GetClassNameCore() { AutomationPeer wrapperPeer = GetWrapperPeer(); if (wrapperPeer != null) { return wrapperPeer.GetClassName(); } else { ThrowElementNotAvailableException(); } return String.Empty; } ////// Gets the control pattern that is associated with the specified System.Windows.Automation.Peers.PatternInterface. /// /// A value from the System.Windows.Automation.Peers.PatternInterface enumeration. ///The object that supports the specified pattern, or null if unsupported. public override object GetPattern(PatternInterface patternInterface) { switch (patternInterface) { case PatternInterface.Invoke: { if (Column != null && Column.CanUserSort) { return this; } break; } case PatternInterface.ScrollItem: { if (Column != null) { return this; } break; } case PatternInterface.Transform: { if (Column != null && Column.CanUserResize) { return this; } break; } case PatternInterface.VirtualizedItem: { if (Column != null) { return this; } break; } } return null; } ////// Gets a value that specifies whether the element is a content element. /// ///true if the element is a content element; otherwise false protected override bool IsContentElementCore() { return false; } #endregion #region IInvokeProvider void IInvokeProvider.Invoke() { UIElementAutomationPeer wrapperPeer = GetWrapperPeer() as UIElementAutomationPeer; if (wrapperPeer != null) { ((DataGridColumnHeader)wrapperPeer.Owner).Invoke(); } else ThrowElementNotAvailableException(); } #endregion #region IScrollItemProvider void IScrollItemProvider.ScrollIntoView() { if (Column != null && this.OwningDataGrid != null) { this.OwningDataGrid.ScrollIntoView(null, Column); } } #endregion #region ITransformProvider bool ITransformProvider.CanMove { get { return false; } } bool ITransformProvider.CanResize { get { if (this.Column != null) return Column.CanUserResize; return false; } } bool ITransformProvider.CanRotate { get { return false; } } void ITransformProvider.Move(double x, double y) { throw new InvalidOperationException(SR.Get(SRID.DataGridColumnHeaderItemAutomationPeer_Unsupported)); } void ITransformProvider.Resize(double width, double height) { if (this.OwningDataGrid != null && Column.CanUserResize) { Column.Width = new DataGridLength(width); } else { throw new InvalidOperationException(SR.Get(SRID.DataGridColumnHeaderItemAutomationPeer_Unresizable)); } } void ITransformProvider.Rotate(double degrees) { throw new InvalidOperationException(SR.Get(SRID.DataGridColumnHeaderItemAutomationPeer_Unsupported)); } #endregion #region IVirtualizedItemProvider void IVirtualizedItemProvider.Realize() { if (this.OwningDataGrid != null) OwningDataGrid.ScrollIntoView(null,Column); } #endregion #region Properties internal override bool AncestorsInvalid { get { return base.AncestorsInvalid; } set { base.AncestorsInvalid = value; if (value) return; AutomationPeer wrapperPeer = OwningColumnHeaderPeer; if (wrapperPeer != null) { wrapperPeer.AncestorsInvalid = false; } } } internal DataGridColumnHeader OwningHeader { get { return GetWrapper() as DataGridColumnHeader; } } internal DataGrid OwningDataGrid { get { return Column.DataGridOwner; } } internal DataGridColumn Column { get { return _column; } } internal DataGridColumnHeaderAutomationPeer OwningColumnHeaderPeer { get { return GetWrapperPeer() as DataGridColumnHeaderAutomationPeer; } } #endregion #region Private Variables DataGridColumn _column; #endregion } } // 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
- BigInt.cs
- WindowsTooltip.cs
- StringUtil.cs
- HwndSourceParameters.cs
- CustomAssemblyResolver.cs
- ConfigurationLocationCollection.cs
- CompoundFileIOPermission.cs
- CellTreeSimplifier.cs
- SqlIdentifier.cs
- ITreeGenerator.cs
- WebPartDisplayModeCancelEventArgs.cs
- DeploymentSectionCache.cs
- ToolStripItemEventArgs.cs
- ConfigurationException.cs
- PeerCollaborationPermission.cs
- RemotingClientProxy.cs
- DrawListViewColumnHeaderEventArgs.cs
- PictureBox.cs
- ExceptionHandlerDesigner.cs
- GlyphCollection.cs
- InitializationEventAttribute.cs
- SetIterators.cs
- HtmlTableRow.cs
- AstNode.cs
- Multiply.cs
- ConfigurationElement.cs
- HMACRIPEMD160.cs
- ObjectTag.cs
- TripleDES.cs
- ToolStripRenderer.cs
- FtpWebRequest.cs
- DataGridTextBox.cs
- HandledEventArgs.cs
- Socket.cs
- ActivityPropertyReference.cs
- GPRECTF.cs
- CurrentChangingEventArgs.cs
- ColorIndependentAnimationStorage.cs
- ResourceCategoryAttribute.cs
- TabControl.cs
- MergablePropertyAttribute.cs
- _SingleItemRequestCache.cs
- SessionStateUtil.cs
- OracleSqlParser.cs
- ScriptingSectionGroup.cs
- CodeExporter.cs
- DispatcherObject.cs
- MediaContext.cs
- TextTreeInsertUndoUnit.cs
- CapabilitiesUse.cs
- MouseButton.cs
- Lease.cs
- ApplicationProxyInternal.cs
- IndependentlyAnimatedPropertyMetadata.cs
- Monitor.cs
- FormatVersion.cs
- ParseElementCollection.cs
- MethodExpression.cs
- NCryptNative.cs
- SequentialUshortCollection.cs
- DetailsViewDeletedEventArgs.cs
- LateBoundBitmapDecoder.cs
- ToolboxComponentsCreatingEventArgs.cs
- UnmanagedMarshal.cs
- OptimizerPatterns.cs
- Evidence.cs
- DummyDataSource.cs
- EventPropertyMap.cs
- ResourceContainer.cs
- XPathAxisIterator.cs
- DataGridViewTextBoxColumn.cs
- SqlCacheDependencyDatabase.cs
- CompensatableTransactionScopeActivity.cs
- TableLayoutSettingsTypeConverter.cs
- DateTimeStorage.cs
- XPathDocument.cs
- FlowDocumentPageViewerAutomationPeer.cs
- SynchronizationContext.cs
- SrgsElementFactory.cs
- MouseButton.cs
- SuppressIldasmAttribute.cs
- TypeNameParser.cs
- PageContent.cs
- AnnotationHelper.cs
- SQLSingle.cs
- TokenBasedSet.cs
- SymmetricKeyWrap.cs
- WizardStepCollectionEditor.cs
- AppDomainShutdownMonitor.cs
- ClickablePoint.cs
- MetafileHeader.cs
- EventManager.cs
- LocationReference.cs
- WebPartDisplayModeEventArgs.cs
- SqlDataSourceEnumerator.cs
- ComplusTypeValidator.cs
- MultipleFilterMatchesException.cs
- DesignerSerializerAttribute.cs
- XPathNodePointer.cs
- DiagnosticsConfiguration.cs