Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / wpf / src / Framework / System / Windows / Automation / Peers / DocumentViewerBaseAutomationPeer.cs / 1 / DocumentViewerBaseAutomationPeer.cs
//---------------------------------------------------------------------------- // // Copyright (C) Microsoft Corporation. All rights reserved. // // File: DocumentViewerBaseAutomationPeer.cs // // Description: AutomationPeer associated with DocumentViewerBase. // //--------------------------------------------------------------------------- using System.Collections.Generic; // Listusing System.Windows.Controls.Primitives; // DocumentViewerBase using System.Windows.Documents; // IDocumentPaginatorSource namespace System.Windows.Automation.Peers { /// /// AutomationPeer associated with DocumentViewerBase. /// public class DocumentViewerBaseAutomationPeer : FrameworkElementAutomationPeer { ////// Constructor. /// /// Owner of the AutomationPeer. public DocumentViewerBaseAutomationPeer(DocumentViewerBase owner) : base(owner) { } ////// public override object GetPattern(PatternInterface patternInterface) { object returnValue = null; if (patternInterface == PatternInterface.Text) { // Make sure that Automation children are created. this.GetChildren(); // Re-expose TextPattern from hosted document. if (_documentPeer != null) { _documentPeer.EventsSource = this; returnValue = _documentPeer.GetPattern(patternInterface); } } return returnValue; } ////// /// ////// /// AutomationPeer associated with DocumentViewerBase returns an AutomationPeer /// for hosted Document and for elements in the style. /// protected override ListGetChildrenCore() { // Get children for all elements in the style. List children = base.GetChildrenCore(); // Add AutomationPeer associated with the document. // Make it the first child of the collection. AutomationPeer documentPeer = GetDocumentAutomationPeer(); if (_documentPeer != documentPeer) { if (_documentPeer != null) { _documentPeer.OnDisconnected(); } _documentPeer = documentPeer as DocumentAutomationPeer; } if (documentPeer != null) { if (children == null) { children = new List (); } children.Add(documentPeer); } return children; } /// /// protected override AutomationControlType GetAutomationControlTypeCore() { return AutomationControlType.Document; } ////// /// protected override string GetClassNameCore() { return "DocumentViewer"; } ////// /// Retrieves AutomationPeer for the document. /// ///private AutomationPeer GetDocumentAutomationPeer() { AutomationPeer documentPeer = null; IDocumentPaginatorSource document = ((DocumentViewerBase)Owner).Document; if (document != null) { if (document is UIElement) { documentPeer = UIElementAutomationPeer.CreatePeerForElement((UIElement)document); } else if (document is ContentElement) { documentPeer = ContentElementAutomationPeer.CreatePeerForElement((ContentElement)document); } } return documentPeer; } private DocumentAutomationPeer _documentPeer; } } // 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: DocumentViewerBaseAutomationPeer.cs // // Description: AutomationPeer associated with DocumentViewerBase. // //--------------------------------------------------------------------------- using System.Collections.Generic; // List using System.Windows.Controls.Primitives; // DocumentViewerBase using System.Windows.Documents; // IDocumentPaginatorSource namespace System.Windows.Automation.Peers { /// /// AutomationPeer associated with DocumentViewerBase. /// public class DocumentViewerBaseAutomationPeer : FrameworkElementAutomationPeer { ////// Constructor. /// /// Owner of the AutomationPeer. public DocumentViewerBaseAutomationPeer(DocumentViewerBase owner) : base(owner) { } ////// public override object GetPattern(PatternInterface patternInterface) { object returnValue = null; if (patternInterface == PatternInterface.Text) { // Make sure that Automation children are created. this.GetChildren(); // Re-expose TextPattern from hosted document. if (_documentPeer != null) { _documentPeer.EventsSource = this; returnValue = _documentPeer.GetPattern(patternInterface); } } return returnValue; } ////// /// ////// /// AutomationPeer associated with DocumentViewerBase returns an AutomationPeer /// for hosted Document and for elements in the style. /// protected override ListGetChildrenCore() { // Get children for all elements in the style. List children = base.GetChildrenCore(); // Add AutomationPeer associated with the document. // Make it the first child of the collection. AutomationPeer documentPeer = GetDocumentAutomationPeer(); if (_documentPeer != documentPeer) { if (_documentPeer != null) { _documentPeer.OnDisconnected(); } _documentPeer = documentPeer as DocumentAutomationPeer; } if (documentPeer != null) { if (children == null) { children = new List (); } children.Add(documentPeer); } return children; } /// /// protected override AutomationControlType GetAutomationControlTypeCore() { return AutomationControlType.Document; } ////// /// protected override string GetClassNameCore() { return "DocumentViewer"; } ////// /// Retrieves AutomationPeer for the document. /// ///private AutomationPeer GetDocumentAutomationPeer() { AutomationPeer documentPeer = null; IDocumentPaginatorSource document = ((DocumentViewerBase)Owner).Document; if (document != null) { if (document is UIElement) { documentPeer = UIElementAutomationPeer.CreatePeerForElement((UIElement)document); } else if (document is ContentElement) { documentPeer = ContentElementAutomationPeer.CreatePeerForElement((ContentElement)document); } } return documentPeer; } private DocumentAutomationPeer _documentPeer; } } // 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
- GAC.cs
- ObjectDataSourceStatusEventArgs.cs
- WmfPlaceableFileHeader.cs
- SevenBitStream.cs
- RotateTransform3D.cs
- BamlTreeMap.cs
- DataControlPagerLinkButton.cs
- BuildTopDownAttribute.cs
- WebPartExportVerb.cs
- EndpointInstanceProvider.cs
- CultureInfo.cs
- GifBitmapEncoder.cs
- StreamHelper.cs
- ClientSettingsSection.cs
- FactoryRecord.cs
- WebPartMovingEventArgs.cs
- DrawingImage.cs
- InsufficientMemoryException.cs
- SourceFileBuildProvider.cs
- MultiSelector.cs
- RowTypePropertyElement.cs
- BezierSegment.cs
- SurrogateSelector.cs
- TemplateKey.cs
- XmlHierarchyData.cs
- TextModifierScope.cs
- TransformPatternIdentifiers.cs
- DbConvert.cs
- SecurityTokenValidationException.cs
- MenuItem.cs
- DataColumnCollection.cs
- StoreContentChangedEventArgs.cs
- NativeDirectoryServicesQueryAPIs.cs
- DocumentNUp.cs
- PointCollectionValueSerializer.cs
- RSAPKCS1SignatureDeformatter.cs
- Invariant.cs
- UserPersonalizationStateInfo.cs
- ProfileProvider.cs
- ConfigurationConverterBase.cs
- VideoDrawing.cs
- ConnectionProviderAttribute.cs
- NavigatorInvalidBodyAccessException.cs
- AssociatedControlConverter.cs
- _AutoWebProxyScriptHelper.cs
- FixedSchema.cs
- TrackBar.cs
- Rule.cs
- AssemblyCollection.cs
- DataSourceUtil.cs
- SqlDelegatedTransaction.cs
- CodeGroup.cs
- RunInstallerAttribute.cs
- SecurityBindingElement.cs
- ProfileEventArgs.cs
- ProjectionNode.cs
- DataBindingList.cs
- ServicesUtilities.cs
- RegexCode.cs
- PeerToPeerException.cs
- PersonalizationState.cs
- SqlMultiplexer.cs
- LinqDataSourceDeleteEventArgs.cs
- ToolStripDropDown.cs
- ThicknessAnimationBase.cs
- StrongNameSignatureInformation.cs
- DocumentReference.cs
- WebPartConnectionsCancelEventArgs.cs
- FontConverter.cs
- MarginCollapsingState.cs
- TableCellCollection.cs
- ComPlusTypeLoader.cs
- SpecialNameAttribute.cs
- OSEnvironmentHelper.cs
- FixedSOMPage.cs
- CustomAssemblyResolver.cs
- Perspective.cs
- PrintingPermissionAttribute.cs
- ObjectComplexPropertyMapping.cs
- TraceListeners.cs
- MemberDescriptor.cs
- CollectionBuilder.cs
- SoapFaultCodes.cs
- AutomationTextAttribute.cs
- RuntimeComponentFilter.cs
- InternalCache.cs
- ColorComboBox.cs
- DataErrorValidationRule.cs
- RegistryKey.cs
- CodeDOMProvider.cs
- StorageComplexPropertyMapping.cs
- GlyphsSerializer.cs
- ValueHandle.cs
- AtomServiceDocumentSerializer.cs
- DataGridTableCollection.cs
- TextCharacters.cs
- ByteKeyFrameCollection.cs
- _RequestCacheProtocol.cs
- HostProtectionPermission.cs
- ServiceModelConfigurationSectionCollection.cs