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
- FlagPanel.cs
- ObjectAnimationBase.cs
- URLIdentityPermission.cs
- AvTrace.cs
- ClientBuildManager.cs
- PolicyLevel.cs
- UserPersonalizationStateInfo.cs
- oledbmetadatacollectionnames.cs
- ZipIOZip64EndOfCentralDirectoryBlock.cs
- Point3DCollectionConverter.cs
- FreezableOperations.cs
- ParagraphVisual.cs
- ReaderWriterLockWrapper.cs
- EmptyReadOnlyDictionaryInternal.cs
- MarshalDirectiveException.cs
- TreeChangeInfo.cs
- WebDescriptionAttribute.cs
- XpsSerializerWriter.cs
- SqlParameterizer.cs
- DataRow.cs
- SingleQueryOperator.cs
- UniformGrid.cs
- ItemContainerGenerator.cs
- DrawingState.cs
- ByteStreamMessageEncoder.cs
- MsmqIntegrationChannelListener.cs
- ScriptReferenceBase.cs
- DataTableNameHandler.cs
- IsolatedStorageFileStream.cs
- XmlCustomFormatter.cs
- OpCodes.cs
- EventLogger.cs
- FormsAuthenticationModule.cs
- WindowsClientCredential.cs
- TreeNodeConverter.cs
- ValueTypeFixupInfo.cs
- JulianCalendar.cs
- LogLogRecordEnumerator.cs
- StylusButton.cs
- OrderedHashRepartitionStream.cs
- ElementProxy.cs
- HostedNamedPipeTransportManager.cs
- CodeExporter.cs
- XmlSchemaSet.cs
- AssemblyHash.cs
- EventProviderWriter.cs
- TextEditorTyping.cs
- SelectionEditingBehavior.cs
- ConnectionsZoneAutoFormat.cs
- EdmConstants.cs
- MenuBase.cs
- ThrowHelper.cs
- ProfilePropertySettings.cs
- WebPartZone.cs
- ActivityDesignerHighlighter.cs
- RegexCode.cs
- BevelBitmapEffect.cs
- XpsColorContext.cs
- NavigationProgressEventArgs.cs
- ConfigXmlCDataSection.cs
- Tokenizer.cs
- OnOperation.cs
- TransformerInfoCollection.cs
- TemplateControlCodeDomTreeGenerator.cs
- Function.cs
- WebCategoryAttribute.cs
- KeyedPriorityQueue.cs
- MouseButtonEventArgs.cs
- MasterPageParser.cs
- FormViewInsertedEventArgs.cs
- QueryReaderSettings.cs
- Timer.cs
- ContextStaticAttribute.cs
- ColorInterpolationModeValidation.cs
- DockingAttribute.cs
- VBIdentifierDesigner.xaml.cs
- ValueType.cs
- ArrayWithOffset.cs
- ListViewTableRow.cs
- NamedObject.cs
- RequestTimeoutManager.cs
- EditorOptionAttribute.cs
- InkCanvasInnerCanvas.cs
- ItemList.cs
- SafeViewOfFileHandle.cs
- _UriSyntax.cs
- Model3DGroup.cs
- Socket.cs
- PersonalizationDictionary.cs
- ExtensionFile.cs
- SQLInt16Storage.cs
- ApplicationManager.cs
- BaseUriHelper.cs
- CapacityStreamGeometryContext.cs
- ComPlusThreadInitializer.cs
- ProxySimple.cs
- FontSource.cs
- InkCanvasAutomationPeer.cs
- ViewBase.cs
- DataGridColumn.cs