Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / Orcas / QFE / wpf / src / Framework / System / Windows / Automation / Peers / GridViewColumnHeaderAutomationPeer.cs / 1 / GridViewColumnHeaderAutomationPeer.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 GridViewColumnHeaderAutomationPeer : FrameworkElementAutomationPeer, IInvokeProvider, ITransformProvider
{
///
public GridViewColumnHeaderAutomationPeer(GridViewColumnHeader owner)
: base(owner)
{
}
///
override protected AutomationControlType GetAutomationControlTypeCore()
{
return AutomationControlType.HeaderItem;
}
///
override protected string GetClassNameCore()
{
return "GridViewColumnHeader";
}
///
override public object GetPattern(PatternInterface patternInterface)
{
if (patternInterface == PatternInterface.Invoke || patternInterface == PatternInterface.Transform)
return this;
return null;
}
void IInvokeProvider.Invoke()
{
if (!IsEnabled())
throw new ElementNotEnabledException();
GridViewColumnHeader owner = (GridViewColumnHeader)Owner;
owner.AutomationClick();
}
#region ITransformProvider
bool ITransformProvider.CanMove { get { return false; } }
//Note: CanResize can be false if Max/MinWidth,Height has been added on GridViewColumn/ColumnHeader
bool ITransformProvider.CanResize { get { return true; } }
bool ITransformProvider.CanRotate { get { return false; } }
//Note: Don't support Move so far, if users do need this feature to reorder columns,
//we can consider to add it later. (One concern is GVCH doesn't support reorder by moving itself)
void ITransformProvider.Move(double x, double y)
{
throw new InvalidOperationException(SR.Get(SRID.UIA_OperationCannotBePerformed));
}
void ITransformProvider.Resize(double width, double height)
{
if (!IsEnabled())
throw new ElementNotEnabledException();
if (width < 0)
{
throw new ArgumentOutOfRangeException("width");
}
if (height < 0)
{
throw new ArgumentOutOfRangeException("height");
}
GridViewColumnHeader header = Owner as GridViewColumnHeader;
if (header != null)
{
if (header.Column != null)
{
header.Column.Width = width;
}
header.Height = height;
}
}
void ITransformProvider.Rotate(double degrees)
{
throw new InvalidOperationException(SR.Get(SRID.UIA_OperationCannotBePerformed));
}
#endregion
}
}
// 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 GridViewColumnHeaderAutomationPeer : FrameworkElementAutomationPeer, IInvokeProvider, ITransformProvider
{
///
public GridViewColumnHeaderAutomationPeer(GridViewColumnHeader owner)
: base(owner)
{
}
///
override protected AutomationControlType GetAutomationControlTypeCore()
{
return AutomationControlType.HeaderItem;
}
///
override protected string GetClassNameCore()
{
return "GridViewColumnHeader";
}
///
override public object GetPattern(PatternInterface patternInterface)
{
if (patternInterface == PatternInterface.Invoke || patternInterface == PatternInterface.Transform)
return this;
return null;
}
void IInvokeProvider.Invoke()
{
if (!IsEnabled())
throw new ElementNotEnabledException();
GridViewColumnHeader owner = (GridViewColumnHeader)Owner;
owner.AutomationClick();
}
#region ITransformProvider
bool ITransformProvider.CanMove { get { return false; } }
//Note: CanResize can be false if Max/MinWidth,Height has been added on GridViewColumn/ColumnHeader
bool ITransformProvider.CanResize { get { return true; } }
bool ITransformProvider.CanRotate { get { return false; } }
//Note: Don't support Move so far, if users do need this feature to reorder columns,
//we can consider to add it later. (One concern is GVCH doesn't support reorder by moving itself)
void ITransformProvider.Move(double x, double y)
{
throw new InvalidOperationException(SR.Get(SRID.UIA_OperationCannotBePerformed));
}
void ITransformProvider.Resize(double width, double height)
{
if (!IsEnabled())
throw new ElementNotEnabledException();
if (width < 0)
{
throw new ArgumentOutOfRangeException("width");
}
if (height < 0)
{
throw new ArgumentOutOfRangeException("height");
}
GridViewColumnHeader header = Owner as GridViewColumnHeader;
if (header != null)
{
if (header.Column != null)
{
header.Column.Width = width;
}
header.Height = height;
}
}
void ITransformProvider.Rotate(double degrees)
{
throw new InvalidOperationException(SR.Get(SRID.UIA_OperationCannotBePerformed));
}
#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
- TrackingProfileCache.cs
- FilterQuery.cs
- UniqueConstraint.cs
- RenderTargetBitmap.cs
- MetadataPropertyvalue.cs
- RoutedEvent.cs
- PowerEase.cs
- Validator.cs
- PerspectiveCamera.cs
- SqlDataAdapter.cs
- ServicePointManager.cs
- BufferModeSettings.cs
- CodeSubDirectoriesCollection.cs
- SqlCharStream.cs
- PropertySet.cs
- UserControlParser.cs
- FamilyCollection.cs
- Stackframe.cs
- Quaternion.cs
- BinaryFormatterSinks.cs
- BindingExpressionBase.cs
- RegexTypeEditor.cs
- GlyphInfoList.cs
- Faults.cs
- LZCodec.cs
- AssemblyName.cs
- CustomBindingCollectionElement.cs
- ReachDocumentPageSerializer.cs
- ObjectQueryExecutionPlan.cs
- FormDesigner.cs
- SessionStateContainer.cs
- LinkedList.cs
- TextSearch.cs
- MatrixCamera.cs
- ColorConverter.cs
- IfAction.cs
- DataRowComparer.cs
- QueryContinueDragEvent.cs
- DbProviderFactory.cs
- RequestResizeEvent.cs
- RequestCacheEntry.cs
- DataGridViewCellStyle.cs
- TypeDescriptor.cs
- Expressions.cs
- ToolStripItemImageRenderEventArgs.cs
- CharEntityEncoderFallback.cs
- WeakReferenceKey.cs
- SelectionRangeConverter.cs
- SchemaDeclBase.cs
- ThicknessConverter.cs
- TypeUsage.cs
- VectorAnimationBase.cs
- CodeStatementCollection.cs
- BufferBuilder.cs
- SQLMembershipProvider.cs
- OleDbTransaction.cs
- TagMapInfo.cs
- ChangePassword.cs
- HttpHandler.cs
- GridViewPageEventArgs.cs
- PackagePart.cs
- FixedTextPointer.cs
- TripleDES.cs
- DataPager.cs
- DataGridViewComponentPropertyGridSite.cs
- SatelliteContractVersionAttribute.cs
- ScrollContentPresenter.cs
- ConstructorNeedsTagAttribute.cs
- AuthorizationRule.cs
- TrackingMemoryStreamFactory.cs
- CDSCollectionETWBCLProvider.cs
- StoryFragments.cs
- PeerContact.cs
- HasActivatableWorkflowEvent.cs
- Profiler.cs
- MemberListBinding.cs
- QueryResults.cs
- SubstitutionList.cs
- ToolStripDesignerAvailabilityAttribute.cs
- RandomDelaySendsAsyncResult.cs
- UserControlFileEditor.cs
- FillErrorEventArgs.cs
- RuntimeWrappedException.cs
- XmlTextWriter.cs
- DbConnectionFactory.cs
- WCFModelStrings.Designer.cs
- EventlogProvider.cs
- StringValidatorAttribute.cs
- ProcessInfo.cs
- EventToken.cs
- FilterQueryOptionExpression.cs
- RectAnimationClockResource.cs
- TrackingStringDictionary.cs
- PropertyEntry.cs
- DataControlCommands.cs
- DataKey.cs
- BackEase.cs
- GatewayDefinition.cs
- TreeNodeCollection.cs
- DetailsViewPageEventArgs.cs