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
- SettingsPropertyValueCollection.cs
- ProcessInfo.cs
- StylusTip.cs
- DataControlExtensions.cs
- MarshalDirectiveException.cs
- HtmlInputControl.cs
- InkCanvasSelection.cs
- FigureParagraph.cs
- InheritanceContextHelper.cs
- UniqueID.cs
- VectorAnimationUsingKeyFrames.cs
- Content.cs
- Matrix3DConverter.cs
- DataGridViewRowDividerDoubleClickEventArgs.cs
- MobileErrorInfo.cs
- ObjectAnimationBase.cs
- Semaphore.cs
- GenerateHelper.cs
- ExpressionVisitor.cs
- StorageInfo.cs
- PtsCache.cs
- LocalBuilder.cs
- SystemPens.cs
- XamlReader.cs
- TypePropertyEditor.cs
- TextFragmentEngine.cs
- WebPartConnectionCollection.cs
- MultiPartWriter.cs
- FormsAuthenticationUserCollection.cs
- TlsSspiNegotiation.cs
- Model3DGroup.cs
- XmlDataSourceView.cs
- DataViewSettingCollection.cs
- ServiceDocument.cs
- PackageProperties.cs
- SiteMapNode.cs
- RowUpdatedEventArgs.cs
- Form.cs
- XmlSchemaAny.cs
- FileClassifier.cs
- WaitForChangedResult.cs
- xdrvalidator.cs
- StorageAssociationTypeMapping.cs
- TextParagraphCache.cs
- MetadataUtilsSmi.cs
- ParameterEditorUserControl.cs
- HttpModuleActionCollection.cs
- SHA1Managed.cs
- XPathAxisIterator.cs
- DataGridTextBoxColumn.cs
- ReadOnlyDictionary.cs
- DetailsView.cs
- HtmlTable.cs
- SafeProcessHandle.cs
- SslStream.cs
- Propagator.JoinPropagator.JoinPredicateVisitor.cs
- HyperLinkDataBindingHandler.cs
- TableLayoutStyleCollection.cs
- TextSerializer.cs
- CriticalHandle.cs
- AutoGeneratedField.cs
- ParserStack.cs
- Relationship.cs
- HtmlInputPassword.cs
- GetWinFXPath.cs
- AtomContentProperty.cs
- XmlHierarchyData.cs
- ScaleTransform.cs
- ConnectionInterfaceCollection.cs
- MobileUITypeEditor.cs
- Vars.cs
- CompileLiteralTextParser.cs
- BitmapEffectInput.cs
- DataGridViewColumnCollection.cs
- Brush.cs
- TrackingConditionCollection.cs
- TreeNode.cs
- ValueUnavailableException.cs
- DispatcherHooks.cs
- MDIWindowDialog.cs
- ColorMatrix.cs
- XmlRawWriter.cs
- ColumnHeader.cs
- UserControlBuildProvider.cs
- WindowsRichEdit.cs
- XmlC14NWriter.cs
- ColorContextHelper.cs
- AsyncInvokeContext.cs
- IntSecurity.cs
- CodeCommentStatementCollection.cs
- CodeDelegateInvokeExpression.cs
- FileDialog_Vista.cs
- WebConfigurationHost.cs
- GridViewCancelEditEventArgs.cs
- DecimalAnimationBase.cs
- HeaderedContentControl.cs
- TTSEngineProxy.cs
- WCFModelStrings.Designer.cs
- XmlSchemaAny.cs
- HttpPostClientProtocol.cs