Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / wpf / src / Framework / System / Windows / Automation / Peers / DocumentPageViewAutomationPeer.cs / 1 / 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
- CompilerTypeWithParams.cs
- FrugalList.cs
- WebPartConnectionsCancelEventArgs.cs
- ExpressionPrefixAttribute.cs
- SQLInt16.cs
- XmlObjectSerializerReadContext.cs
- DesignBindingConverter.cs
- Point3DIndependentAnimationStorage.cs
- TimerEventSubscription.cs
- ListControlBoundActionList.cs
- UIInitializationException.cs
- DbCommandTree.cs
- DataSourceView.cs
- Renderer.cs
- AnnotationObservableCollection.cs
- TextContainer.cs
- TextFormattingConverter.cs
- ElementInit.cs
- XPathConvert.cs
- DataPagerFieldItem.cs
- XmlComplianceUtil.cs
- OleServicesContext.cs
- ExternalException.cs
- UInt32Storage.cs
- FormatConvertedBitmap.cs
- StorageBasedPackageProperties.cs
- WindowsToolbarItemAsMenuItem.cs
- DBConnection.cs
- IisTraceWebEventProvider.cs
- Volatile.cs
- RSAOAEPKeyExchangeDeformatter.cs
- Publisher.cs
- QilLoop.cs
- safemediahandle.cs
- PeerApplicationLaunchInfo.cs
- StaticExtensionConverter.cs
- LogEntrySerializer.cs
- ListControl.cs
- ClockController.cs
- WhitespaceRule.cs
- ProfileBuildProvider.cs
- XmlDictionaryReader.cs
- NotConverter.cs
- EntityDesignerBuildProvider.cs
- SqlCommandBuilder.cs
- SqlMethodTransformer.cs
- UTF32Encoding.cs
- DynamicResourceExtension.cs
- ObjectTokenCategory.cs
- TempFiles.cs
- Nullable.cs
- CachedTypeface.cs
- ObjectKeyFrameCollection.cs
- WebPartEditVerb.cs
- BaseInfoTable.cs
- DecimalAnimationBase.cs
- HttpCapabilitiesBase.cs
- WaitHandleCannotBeOpenedException.cs
- HttpRequestCacheValidator.cs
- CustomTypeDescriptor.cs
- MediaPlayerState.cs
- TraversalRequest.cs
- BinaryKeyIdentifierClause.cs
- Trace.cs
- MetadataItem_Static.cs
- TextChange.cs
- ExeConfigurationFileMap.cs
- DetailsViewPagerRow.cs
- MetadataItemSerializer.cs
- VisualTarget.cs
- MetadataFile.cs
- X509RawDataKeyIdentifierClause.cs
- PropertyGrid.cs
- grammarelement.cs
- WindowsListViewItem.cs
- SequentialUshortCollection.cs
- StaticContext.cs
- Viewport2DVisual3D.cs
- ISessionStateStore.cs
- TransactedBatchingElement.cs
- EUCJPEncoding.cs
- SelfIssuedSamlTokenFactory.cs
- ClientApiGenerator.cs
- SmtpDigestAuthenticationModule.cs
- XmlNotation.cs
- Cursor.cs
- CodeSnippetCompileUnit.cs
- PropertyEmitterBase.cs
- TreeViewImageIndexConverter.cs
- AuthorizationSection.cs
- WebConfigurationHost.cs
- COM2PropertyDescriptor.cs
- TraceSource.cs
- LicenseException.cs
- EditorPartCollection.cs
- DataGridRow.cs
- Line.cs
- FormViewCommandEventArgs.cs
- PtsContext.cs
- DBSqlParserTable.cs