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
- AsymmetricSignatureDeformatter.cs
- AppSettings.cs
- CustomAttributeBuilder.cs
- IteratorFilter.cs
- CompilerCollection.cs
- ExecutionEngineException.cs
- KerberosSecurityTokenAuthenticator.cs
- TextPointer.cs
- JsonFormatReaderGenerator.cs
- UidManager.cs
- IPHostEntry.cs
- HitTestDrawingContextWalker.cs
- TypeContext.cs
- RegexNode.cs
- ControlCachePolicy.cs
- Permission.cs
- XmlConvert.cs
- BufferedGraphicsContext.cs
- Polygon.cs
- CodeConditionStatement.cs
- FileDialog.cs
- COM2PropertyDescriptor.cs
- WindowsComboBox.cs
- ContentWrapperAttribute.cs
- Timer.cs
- Input.cs
- TextTreeDeleteContentUndoUnit.cs
- RoutingExtension.cs
- Converter.cs
- XamlPoint3DCollectionSerializer.cs
- LoginCancelEventArgs.cs
- CompoundFileStorageReference.cs
- _IPv4Address.cs
- CallContext.cs
- RoutedUICommand.cs
- ReferencedAssembly.cs
- Int32CAMarshaler.cs
- XmlDsigSep2000.cs
- ProfileManager.cs
- EntityContainerEntitySet.cs
- BaseCAMarshaler.cs
- RadioButtonPopupAdapter.cs
- BaseAppDomainProtocolHandler.cs
- BaseCollection.cs
- XmlQuerySequence.cs
- CollectionView.cs
- XmlArrayItemAttribute.cs
- MediaElementAutomationPeer.cs
- XmlArrayItemAttributes.cs
- WorkflowOperationAsyncResult.cs
- Int32RectConverter.cs
- RichTextBox.cs
- HwndMouseInputProvider.cs
- InternalBufferOverflowException.cs
- DistinctQueryOperator.cs
- AssemblyName.cs
- CodeChecksumPragma.cs
- Deflater.cs
- Part.cs
- TabItemAutomationPeer.cs
- XsltContext.cs
- ListCardsInFileRequest.cs
- ReflectionTypeLoadException.cs
- AnchoredBlock.cs
- HitTestResult.cs
- ListBindingConverter.cs
- Context.cs
- PropertyValueChangedEvent.cs
- StringComparer.cs
- SoapFault.cs
- SqlNodeTypeOperators.cs
- Translator.cs
- FolderBrowserDialog.cs
- HtmlPageAdapter.cs
- FontWeights.cs
- Bitmap.cs
- XamlStyleSerializer.cs
- ListenerTraceUtility.cs
- CapabilitiesSection.cs
- DbQueryCommandTree.cs
- XmlCDATASection.cs
- EdmProviderManifest.cs
- BuilderInfo.cs
- _SSPIWrapper.cs
- MethodBuilder.cs
- ParenthesizePropertyNameAttribute.cs
- Update.cs
- FutureFactory.cs
- BindingMemberInfo.cs
- XmlChoiceIdentifierAttribute.cs
- XmlSerializerFactory.cs
- SelectionRangeConverter.cs
- ResourceWriter.cs
- BCryptSafeHandles.cs
- System.Data_BID.cs
- HttpListenerRequest.cs
- Activity.cs
- BamlCollectionHolder.cs
- DelegatingConfigHost.cs
- AsmxEndpointPickerExtension.cs