Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / Orcas / QFE / 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
- AsyncResult.cs
- ArrayConverter.cs
- exports.cs
- SqlHelper.cs
- BrowserCapabilitiesCodeGenerator.cs
- WorkflowMarkupSerializationException.cs
- DrawingGroupDrawingContext.cs
- ExpandSegment.cs
- StructuredCompositeActivityDesigner.cs
- LoadedEvent.cs
- Module.cs
- FrugalMap.cs
- EpmContentSerializerBase.cs
- OdbcCommand.cs
- ManagementObjectCollection.cs
- FamilyTypeface.cs
- EncoderParameter.cs
- AutomationPropertyInfo.cs
- Internal.cs
- SchemaImporterExtensionElement.cs
- ExitEventArgs.cs
- ParameterModifier.cs
- LocatorPart.cs
- FactoryMaker.cs
- RectangleGeometry.cs
- DataGridViewColumnEventArgs.cs
- QueueNameHelper.cs
- CqlBlock.cs
- XPathChildIterator.cs
- IndentedTextWriter.cs
- ParserStreamGeometryContext.cs
- SafeFileMappingHandle.cs
- DataGridViewCellLinkedList.cs
- ApplicationException.cs
- XmlSchemaComplexType.cs
- SecurityTimestamp.cs
- WindowsImpersonationContext.cs
- Speller.cs
- LinearGradientBrush.cs
- PersonalizationProvider.cs
- DataReaderContainer.cs
- SqlReferenceCollection.cs
- metadatamappinghashervisitor.hashsourcebuilder.cs
- AnimatedTypeHelpers.cs
- FormattedText.cs
- ListViewItemCollectionEditor.cs
- LexicalChunk.cs
- FileResponseElement.cs
- XamlNamespaceHelper.cs
- UnionCodeGroup.cs
- BuildResultCache.cs
- InfoCardRSACryptoProvider.cs
- Constants.cs
- ResourceCategoryAttribute.cs
- DataGridTable.cs
- DeferrableContentConverter.cs
- DragDrop.cs
- InstalledFontCollection.cs
- Pool.cs
- EventPrivateKey.cs
- BufferedGenericXmlSecurityToken.cs
- updatecommandorderer.cs
- NavigationFailedEventArgs.cs
- RegexCharClass.cs
- DesignerAttribute.cs
- DataGridViewCellCollection.cs
- MultiViewDesigner.cs
- HttpListenerPrefixCollection.cs
- DataSvcMapFileSerializer.cs
- OrderingExpression.cs
- PersistenceProviderDirectory.cs
- CursorConverter.cs
- DbDataRecord.cs
- FormViewUpdateEventArgs.cs
- QueryPageSettingsEventArgs.cs
- MetadataCache.cs
- Signature.cs
- ActiveXSite.cs
- GroupByExpressionRewriter.cs
- CustomAttribute.cs
- EntityCommandDefinition.cs
- __TransparentProxy.cs
- FormatException.cs
- TextDecoration.cs
- ProcessHostConfigUtils.cs
- ColumnWidthChangingEvent.cs
- XmlILStorageConverter.cs
- RoleGroupCollection.cs
- MD5Cng.cs
- IpcPort.cs
- RuleRef.cs
- DataGridState.cs
- EntityDesignerBuildProvider.cs
- Trigger.cs
- PreservationFileWriter.cs
- SchemaMapping.cs
- Int32Storage.cs
- NotCondition.cs
- ListComponentEditorPage.cs
- AudioFormatConverter.cs