Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / Orcas / NetFXw7 / 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
- Aes.cs
- MetadataItem_Static.cs
- DataSourceCache.cs
- Win32MouseDevice.cs
- GridView.cs
- IPEndPoint.cs
- Operators.cs
- WebBrowserProgressChangedEventHandler.cs
- HuffCodec.cs
- RtfToXamlReader.cs
- RegexGroup.cs
- AmbientProperties.cs
- CatalogZone.cs
- SettingsPropertyCollection.cs
- OleDbConnectionInternal.cs
- QueryIntervalOp.cs
- NameSpaceExtractor.cs
- DelegateTypeInfo.cs
- CompilerInfo.cs
- Win32.cs
- AttachmentService.cs
- NamespaceDecl.cs
- BaseResourcesBuildProvider.cs
- DecimalFormatter.cs
- HttpWriter.cs
- WhitespaceReader.cs
- ForwardPositionQuery.cs
- _ProxyRegBlob.cs
- AxHost.cs
- ScaleTransform.cs
- Sql8ExpressionRewriter.cs
- AvTraceDetails.cs
- ContentIterators.cs
- TextModifier.cs
- DispatcherExceptionEventArgs.cs
- DataGridViewUtilities.cs
- KeyConverter.cs
- UnsafeNativeMethods.cs
- GetPageNumberCompletedEventArgs.cs
- XamlClipboardData.cs
- BinaryNode.cs
- VirtualizingStackPanel.cs
- mediaclock.cs
- CustomErrorCollection.cs
- Brushes.cs
- COM2Enum.cs
- IImplicitResourceProvider.cs
- BaseProcessor.cs
- FrameworkReadOnlyPropertyMetadata.cs
- SettingsPropertyNotFoundException.cs
- ContentOperations.cs
- ExtenderControl.cs
- WebPartDisplayMode.cs
- PointIndependentAnimationStorage.cs
- InputLangChangeEvent.cs
- SRef.cs
- SqlUserDefinedAggregateAttribute.cs
- WebPartTransformerCollection.cs
- XmlDeclaration.cs
- SafeNativeMethods.cs
- OuterGlowBitmapEffect.cs
- CurrentChangingEventArgs.cs
- StatusInfoItem.cs
- Matrix3D.cs
- FunctionParameter.cs
- SmiSettersStream.cs
- CredentialCache.cs
- MetadataArtifactLoaderXmlReaderWrapper.cs
- DataGridViewCellConverter.cs
- SqlDependencyListener.cs
- StyleXamlParser.cs
- FactoryGenerator.cs
- ExeContext.cs
- NamespaceListProperty.cs
- PanelStyle.cs
- FormCollection.cs
- AdapterDictionary.cs
- ThemeDictionaryExtension.cs
- TextEmbeddedObject.cs
- HttpCookiesSection.cs
- Semaphore.cs
- CqlParserHelpers.cs
- PrintPreviewDialog.cs
- ParagraphResult.cs
- DataGridColumnFloatingHeader.cs
- TempEnvironment.cs
- DetailsViewInsertEventArgs.cs
- DesignTimeDataBinding.cs
- SmiContext.cs
- CopyOnWriteList.cs
- XmlSchemaSimpleType.cs
- QueryCacheKey.cs
- UnSafeCharBuffer.cs
- BoolLiteral.cs
- StringSource.cs
- PolicyManager.cs
- MissingMemberException.cs
- ViewBase.cs
- LabelLiteral.cs
- ListSourceHelper.cs