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
- CommandBinding.cs
- DataGridViewColumnCollectionEditor.cs
- ValueType.cs
- UnicodeEncoding.cs
- SingleSelectRootGridEntry.cs
- SqlBuilder.cs
- ToolboxCategoryItems.cs
- QueryRelOp.cs
- ButtonChrome.cs
- RichTextBoxConstants.cs
- HttpWebResponse.cs
- XmlWellformedWriterHelpers.cs
- SmtpSpecifiedPickupDirectoryElement.cs
- XhtmlTextWriter.cs
- TypeSystem.cs
- PathFigureCollection.cs
- BridgeDataReader.cs
- RelationshipWrapper.cs
- TreeViewCancelEvent.cs
- SqlInfoMessageEvent.cs
- BrowserCapabilitiesCompiler.cs
- userdatakeys.cs
- ContextStaticAttribute.cs
- CustomAttributeFormatException.cs
- XmlIlVisitor.cs
- UrlParameterReader.cs
- XamlFilter.cs
- _ChunkParse.cs
- CodeNamespace.cs
- DBSchemaTable.cs
- TypePresenter.xaml.cs
- SqlWebEventProvider.cs
- ImageMapEventArgs.cs
- SqlParameter.cs
- WebPartActionVerb.cs
- TypeUsage.cs
- QilReference.cs
- OleDbConnection.cs
- Comparer.cs
- UnSafeCharBuffer.cs
- SafeFileMappingHandle.cs
- SystemDropShadowChrome.cs
- HwndSourceParameters.cs
- Material.cs
- ExtendedProperty.cs
- Blend.cs
- SimpleHandlerBuildProvider.cs
- EditorPart.cs
- RegistryExceptionHelper.cs
- ADMembershipUser.cs
- QilInvokeLateBound.cs
- DLinqDataModelProvider.cs
- WCFModelStrings.Designer.cs
- WeakEventTable.cs
- ListViewUpdateEventArgs.cs
- WebBrowserEvent.cs
- BooleanExpr.cs
- WebPartEditorCancelVerb.cs
- ToolStripItemBehavior.cs
- XmlReflectionImporter.cs
- EditorZoneBase.cs
- SystemIcmpV6Statistics.cs
- InternalConfigEventArgs.cs
- TreeNode.cs
- DbMetaDataFactory.cs
- CultureInfoConverter.cs
- XsltSettings.cs
- ToolStripProfessionalLowResolutionRenderer.cs
- BitmapFrameEncode.cs
- BasicAsyncResult.cs
- AttributeData.cs
- WorkflowDefinitionDispenser.cs
- HttpBindingExtension.cs
- HTTPNotFoundHandler.cs
- HttpSessionStateWrapper.cs
- ObjectSecurity.cs
- FixedStringLookup.cs
- Validator.cs
- SwitchLevelAttribute.cs
- TextEndOfLine.cs
- SmtpNetworkElement.cs
- NonBatchDirectoryCompiler.cs
- SurrogateSelector.cs
- DbMetaDataColumnNames.cs
- AVElementHelper.cs
- LambdaCompiler.Statements.cs
- PriorityBindingExpression.cs
- BitmapEffectOutputConnector.cs
- TripleDESCryptoServiceProvider.cs
- ScriptResourceInfo.cs
- PenThreadWorker.cs
- WebPartCloseVerb.cs
- RegexCaptureCollection.cs
- WindowsIdentity.cs
- ResourceReader.cs
- LinkedResourceCollection.cs
- DataGridViewColumnStateChangedEventArgs.cs
- SystemResourceKey.cs
- ColumnHeader.cs
- ObjectCloneHelper.cs