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
- GrammarBuilder.cs
- ExpressionEditorAttribute.cs
- DocumentXmlWriter.cs
- InputProviderSite.cs
- AttributeProviderAttribute.cs
- TableLayout.cs
- ArraySortHelper.cs
- VisualBasicImportReference.cs
- SizeConverter.cs
- ObjectStateEntryDbDataRecord.cs
- CurrentTimeZone.cs
- SQLByteStorage.cs
- ClipboardData.cs
- Scheduler.cs
- RegexParser.cs
- AsynchronousChannel.cs
- UpDownEvent.cs
- SessionStateModule.cs
- GeneralTransform3DTo2DTo3D.cs
- BamlResourceContent.cs
- ValueTypeFixupInfo.cs
- formatter.cs
- DataGridViewRowStateChangedEventArgs.cs
- DomainConstraint.cs
- NamedPipeAppDomainProtocolHandler.cs
- DesignerDataSchemaClass.cs
- _ConnectOverlappedAsyncResult.cs
- LinkUtilities.cs
- MultiSelector.cs
- SafeThreadHandle.cs
- FilteredAttributeCollection.cs
- CheckBoxField.cs
- OrderablePartitioner.cs
- SolidColorBrush.cs
- KnownTypes.cs
- ShapingEngine.cs
- XmlnsPrefixAttribute.cs
- FormParameter.cs
- ClientUrlResolverWrapper.cs
- GraphicsState.cs
- ColumnBinding.cs
- errorpatternmatcher.cs
- NonParentingControl.cs
- DataFormat.cs
- VisualBrush.cs
- MimeFormReflector.cs
- LinearKeyFrames.cs
- TextBoxBaseDesigner.cs
- EFAssociationProvider.cs
- ScriptMethodAttribute.cs
- RuntimeIdentifierPropertyAttribute.cs
- NativeBuffer.cs
- DictionaryManager.cs
- PlainXmlDeserializer.cs
- Calendar.cs
- Converter.cs
- GacUtil.cs
- AndCondition.cs
- SmtpException.cs
- TypeUtil.cs
- FileLogRecord.cs
- StringResourceManager.cs
- Attributes.cs
- WebPartTransformer.cs
- UseManagedPresentationBindingElement.cs
- ICspAsymmetricAlgorithm.cs
- WSAddressing10ProblemHeaderQNameFault.cs
- DocumentsTrace.cs
- ProgressBarRenderer.cs
- DocumentReferenceCollection.cs
- BackgroundFormatInfo.cs
- XPathChildIterator.cs
- Site.cs
- Schema.cs
- UIElementAutomationPeer.cs
- OutputWindow.cs
- XmlReader.cs
- XmlObjectSerializerReadContextComplexJson.cs
- EncryptedType.cs
- XmlHelper.cs
- XslTransform.cs
- X509AsymmetricSecurityKey.cs
- HttpConfigurationSystem.cs
- SynchronizedDisposablePool.cs
- FamilyMapCollection.cs
- TemplateInstanceAttribute.cs
- BaseCollection.cs
- DefaultTraceListener.cs
- ScriptingScriptResourceHandlerSection.cs
- autovalidator.cs
- TextDecoration.cs
- WaitForChangedResult.cs
- MessageBox.cs
- StorageMappingItemLoader.cs
- UnmanagedMarshal.cs
- ResetableIterator.cs
- Lasso.cs
- EntityContainerEntitySet.cs
- TableDetailsCollection.cs
- BrowserDefinitionCollection.cs