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
- PerformanceCounterCategory.cs
- NamedServiceModelExtensionCollectionElement.cs
- DataGridCell.cs
- HyperLinkColumn.cs
- TabControlCancelEvent.cs
- GeometryCombineModeValidation.cs
- DataFormats.cs
- XmlObjectSerializerWriteContextComplexJson.cs
- DoubleCollectionConverter.cs
- AttachmentCollection.cs
- UniqueContractNameValidationBehavior.cs
- ComplusEndpointConfigContainer.cs
- ObjectDataSourceDesigner.cs
- EditCommandColumn.cs
- PKCS1MaskGenerationMethod.cs
- SettingsBindableAttribute.cs
- DataTableReader.cs
- TreeViewItemAutomationPeer.cs
- ConfigurationPropertyAttribute.cs
- MD5CryptoServiceProvider.cs
- PropertyMapper.cs
- ProcessInputEventArgs.cs
- HtmlInputRadioButton.cs
- GradientBrush.cs
- TextDecorationCollectionConverter.cs
- ClientSession.cs
- ImageButton.cs
- ZipIOZip64EndOfCentralDirectoryBlock.cs
- XmlSecureResolver.cs
- UnsafeNativeMethods.cs
- SymbolEqualComparer.cs
- IProvider.cs
- DateTimeFormatInfoScanner.cs
- BuildManagerHost.cs
- InvalidOleVariantTypeException.cs
- InternalPermissions.cs
- FixedPosition.cs
- TreeNodeConverter.cs
- StringTraceRecord.cs
- BulletChrome.cs
- ApplicationFileParser.cs
- PersistenceProviderBehavior.cs
- SingleSelectRootGridEntry.cs
- BindingSource.cs
- _ShellExpression.cs
- Lasso.cs
- TextSpan.cs
- SelectionItemProviderWrapper.cs
- OleDbParameterCollection.cs
- ElementHost.cs
- SourceInterpreter.cs
- NetworkInterface.cs
- EntitySetBase.cs
- _SpnDictionary.cs
- FormViewRow.cs
- SecurityException.cs
- URLString.cs
- CompositeScriptReference.cs
- UnknownBitmapEncoder.cs
- WindowsSpinner.cs
- _ScatterGatherBuffers.cs
- SessionEndingCancelEventArgs.cs
- XmlRawWriter.cs
- GACMembershipCondition.cs
- HideDisabledControlAdapter.cs
- TypeSemantics.cs
- filewebrequest.cs
- XmlCharacterData.cs
- HttpCapabilitiesEvaluator.cs
- ChannelBase.cs
- ImageInfo.cs
- AdRotatorDesigner.cs
- oledbconnectionstring.cs
- Style.cs
- BlockingCollection.cs
- TextModifier.cs
- AssociationTypeEmitter.cs
- XmlEncodedRawTextWriter.cs
- EmptyQuery.cs
- BitArray.cs
- DocumentXmlWriter.cs
- DeploymentSection.cs
- SymbolMethod.cs
- Helpers.cs
- MeasureData.cs
- DispatcherEventArgs.cs
- LinqTreeNodeEvaluator.cs
- IgnorePropertiesAttribute.cs
- BoolExpressionVisitors.cs
- XmlNodeComparer.cs
- RotateTransform.cs
- ObjectDataSourceChooseTypePanel.cs
- ObjectSecurity.cs
- DetailsViewRowCollection.cs
- XmlRawWriterWrapper.cs
- SystemIcons.cs
- HatchBrush.cs
- MobileContainerDesigner.cs
- ResourceType.cs
- ECDiffieHellmanCng.cs