Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / wpf / src / Framework / System / Windows / Automation / Peers / DocumentViewerBaseAutomationPeer.cs / 1305600 / 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); } } else { returnValue = base.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
- PeerApplication.cs
- EmptyQuery.cs
- ReflectEventDescriptor.cs
- NullRuntimeConfig.cs
- GetRecipientRequest.cs
- FormViewCommandEventArgs.cs
- DiagnosticEventProvider.cs
- SqlBuffer.cs
- WindowsListViewGroupHelper.cs
- ToolTipAutomationPeer.cs
- AsymmetricCryptoHandle.cs
- Predicate.cs
- ExecutedRoutedEventArgs.cs
- PolygonHotSpot.cs
- TouchesCapturedWithinProperty.cs
- SqlUnionizer.cs
- AsymmetricKeyExchangeFormatter.cs
- LiteralTextParser.cs
- CodeSubDirectory.cs
- HttpCacheVaryByContentEncodings.cs
- SchemaTypeEmitter.cs
- TraceData.cs
- PackagingUtilities.cs
- SqlVisitor.cs
- DecoderFallbackWithFailureFlag.cs
- filewebrequest.cs
- PackUriHelper.cs
- ResourceExpression.cs
- CachedRequestParams.cs
- ProcessModuleCollection.cs
- EncoderNLS.cs
- Pkcs7Signer.cs
- SamlConstants.cs
- ConnectionPoolManager.cs
- HierarchicalDataSourceConverter.cs
- ApplicationInfo.cs
- ToolStripSplitStackLayout.cs
- COM2Enum.cs
- storepermission.cs
- PathTooLongException.cs
- TextTreeUndo.cs
- XPathParser.cs
- PeerToPeerException.cs
- ToolBarPanel.cs
- ControlBuilderAttribute.cs
- InheritablePropertyChangeInfo.cs
- PlainXmlSerializer.cs
- PropertyChangedEventManager.cs
- ViewStateException.cs
- LinkedResourceCollection.cs
- ChannelServices.cs
- XslNumber.cs
- RadioButtonList.cs
- BamlRecords.cs
- XmlSchemaSet.cs
- SqlDataSourceCommandEventArgs.cs
- EditingMode.cs
- WindowsScroll.cs
- RuntimeHelpers.cs
- DBConcurrencyException.cs
- EntityViewGenerationAttribute.cs
- DaylightTime.cs
- CodeBinaryOperatorExpression.cs
- Parameter.cs
- errorpatternmatcher.cs
- PenThread.cs
- HitTestDrawingContextWalker.cs
- NonPrimarySelectionGlyph.cs
- UnauthorizedWebPart.cs
- ThemeDirectoryCompiler.cs
- CommandHelpers.cs
- _NegotiateClient.cs
- HttpConfigurationContext.cs
- FuncTypeConverter.cs
- StringResourceManager.cs
- _TransmitFileOverlappedAsyncResult.cs
- UIElementIsland.cs
- ToolStripRenderEventArgs.cs
- DocumentsTrace.cs
- SignedXml.cs
- RenderTargetBitmap.cs
- TextParaLineResult.cs
- PixelFormat.cs
- ChannelBinding.cs
- KeyboardEventArgs.cs
- SymbolDocumentInfo.cs
- CodeSnippetStatement.cs
- ReceiveErrorHandling.cs
- SimpleMailWebEventProvider.cs
- IntegerValidator.cs
- ProfileEventArgs.cs
- LoginStatusDesigner.cs
- HostingPreferredMapPath.cs
- DebugHandleTracker.cs
- InputBuffer.cs
- DataObjectCopyingEventArgs.cs
- ValidatorCollection.cs
- XamlWriterExtensions.cs
- EntityFunctions.cs
- WebBaseEventKeyComparer.cs