Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / wpf / src / Framework / System / Windows / Automation / Peers / DocumentPageViewAutomationPeer.cs / 1305600 / DocumentPageViewAutomationPeer.cs
//---------------------------------------------------------------------------- // // Copyright (C) Microsoft Corporation. All rights reserved. // // File: DocumentPageViewAutomationPeer.cs // // Description: AutomationPeer associated with DocumentPageView. // //--------------------------------------------------------------------------- using System.Collections.Generic; // Listusing System.Globalization; // CultureInfo using System.Windows.Controls; // DocumentViewer using System.Windows.Controls.Primitives; // DocumentPageView namespace System.Windows.Automation.Peers { /// /// AutomationPeer associated with DocumentPageView. /// public class DocumentPageViewAutomationPeer : FrameworkElementAutomationPeer { ////// Constructor. /// /// Owner of the AutomationPeer. public DocumentPageViewAutomationPeer(DocumentPageView owner) : base(owner) {} ////// ////// /// AutomationPeer associated with DocumentPageView blocks any exposure /// of the currently hosted page. So it returns empty collection of children. /// protected override ListGetChildrenCore() { return null; } /// /// ////// A string representing the current DocumentPageView. protected override string GetAutomationIdCore() { // Initialize the result to Empty, so that if Name is not set on the // DocumentPageView, and there is no valid PageNumber set, then the // AutomationId will remain blank to avoid duplicate entries. string result = string.Empty; DocumentPageView owner = (DocumentPageView)Owner; // Check if a Name is already set on the DocumentPageView, otherwise attempt // to construct one. if (!string.IsNullOrEmpty(owner.Name)) { result = owner.Name; } else if ((owner.PageNumber >= 0) && (owner.PageNumber < int.MaxValue)) { // This will set the AutomationId to a string that represents the current // page number, i.e. "DocumentPage1" will represent the first page. These numbers // will be kept in a 1-indexed format. InvariantCulture is used to ensure // that these AutomationIds will not change with the language, so that they // can be trusted to always work in automation. result = String.Format(CultureInfo.InvariantCulture, "DocumentPage{0}", owner.PageNumber + 1); } return result; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved. //---------------------------------------------------------------------------- // // Copyright (C) Microsoft Corporation. All rights reserved. // // File: DocumentPageViewAutomationPeer.cs // // Description: AutomationPeer associated with DocumentPageView. // //--------------------------------------------------------------------------- using System.Collections.Generic; // Listusing System.Globalization; // CultureInfo using System.Windows.Controls; // DocumentViewer using System.Windows.Controls.Primitives; // DocumentPageView namespace System.Windows.Automation.Peers { /// /// AutomationPeer associated with DocumentPageView. /// public class DocumentPageViewAutomationPeer : FrameworkElementAutomationPeer { ////// Constructor. /// /// Owner of the AutomationPeer. public DocumentPageViewAutomationPeer(DocumentPageView owner) : base(owner) {} ////// ////// /// AutomationPeer associated with DocumentPageView blocks any exposure /// of the currently hosted page. So it returns empty collection of children. /// protected override ListGetChildrenCore() { return null; } /// /// ////// A string representing the current DocumentPageView. protected override string GetAutomationIdCore() { // Initialize the result to Empty, so that if Name is not set on the // DocumentPageView, and there is no valid PageNumber set, then the // AutomationId will remain blank to avoid duplicate entries. string result = string.Empty; DocumentPageView owner = (DocumentPageView)Owner; // Check if a Name is already set on the DocumentPageView, otherwise attempt // to construct one. if (!string.IsNullOrEmpty(owner.Name)) { result = owner.Name; } else if ((owner.PageNumber >= 0) && (owner.PageNumber < int.MaxValue)) { // This will set the AutomationId to a string that represents the current // page number, i.e. "DocumentPage1" will represent the first page. These numbers // will be kept in a 1-indexed format. InvariantCulture is used to ensure // that these AutomationIds will not change with the language, so that they // can be trusted to always work in automation. result = String.Format(CultureInfo.InvariantCulture, "DocumentPage{0}", owner.PageNumber + 1); } return result; } } } // 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
- ServiceDescriptionSerializer.cs
- IndexedEnumerable.cs
- SID.cs
- FunctionDescription.cs
- EndpointIdentityConverter.cs
- PerformanceCounter.cs
- ListBoxItem.cs
- Point3DCollection.cs
- HttpModulesSection.cs
- ProfilePropertySettingsCollection.cs
- BitmapScalingModeValidation.cs
- AvTraceFormat.cs
- PingOptions.cs
- OdbcConnectionStringbuilder.cs
- InstancePersistenceCommandException.cs
- RoleManagerSection.cs
- StorageScalarPropertyMapping.cs
- StorageAssociationTypeMapping.cs
- securitycriticaldataformultiplegetandset.cs
- SQLConvert.cs
- HttpHandlerAction.cs
- ObservableCollectionDefaultValueFactory.cs
- WindowsNonControl.cs
- CodeTypeReferenceCollection.cs
- WCFBuildProvider.cs
- JsonQNameDataContract.cs
- SemanticAnalyzer.cs
- PixelFormatConverter.cs
- AsymmetricAlgorithm.cs
- PermissionAttributes.cs
- SpellerHighlightLayer.cs
- dataobject.cs
- HttpStreamMessageEncoderFactory.cs
- SkinBuilder.cs
- SizeValueSerializer.cs
- XmlSerializerVersionAttribute.cs
- GenericRootAutomationPeer.cs
- HMACSHA384.cs
- BooleanFacetDescriptionElement.cs
- CalendarDay.cs
- MarshalByRefObject.cs
- XmlSchemaNotation.cs
- WebControl.cs
- FileIOPermission.cs
- typedescriptorpermission.cs
- ImageMapEventArgs.cs
- WeakReference.cs
- PagedDataSource.cs
- SqlDelegatedTransaction.cs
- CompositeControl.cs
- PassportPrincipal.cs
- SynchronizationLockException.cs
- EntityDataSourceContextDisposingEventArgs.cs
- HtmlElementErrorEventArgs.cs
- TextRangeEdit.cs
- StringStorage.cs
- XmlQualifiedNameTest.cs
- PersonalizableAttribute.cs
- WMICapabilities.cs
- TagMapInfo.cs
- ElementProxy.cs
- NetPipeSection.cs
- RouteParser.cs
- ConstructorExpr.cs
- CodeComment.cs
- DefaultSection.cs
- ListViewCommandEventArgs.cs
- XmlCharCheckingReader.cs
- BindingList.cs
- StateMachineHelpers.cs
- XmlAttributeProperties.cs
- AssemblyName.cs
- XamlFilter.cs
- CacheForPrimitiveTypes.cs
- ClientSponsor.cs
- HandleCollector.cs
- ValidatedControlConverter.cs
- IDReferencePropertyAttribute.cs
- Operators.cs
- ExternalDataExchangeService.cs
- Condition.cs
- HtmlControl.cs
- SafeBitVector32.cs
- XPathNavigatorKeyComparer.cs
- SweepDirectionValidation.cs
- TextBoxRenderer.cs
- EUCJPEncoding.cs
- Expr.cs
- SqlStream.cs
- CodeAccessSecurityEngine.cs
- CacheDependency.cs
- WSSecurityOneDotOneReceiveSecurityHeader.cs
- UnsafeNativeMethods.cs
- entitydatasourceentitysetnameconverter.cs
- ReferentialConstraint.cs
- BamlRecordHelper.cs
- NativeMethods.cs
- CheckBoxField.cs
- DynamicMethod.cs
- IconBitmapDecoder.cs