Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / 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
- PhysicalAddress.cs
- StaticExtension.cs
- Line.cs
- AnchorEditor.cs
- ResolveDuplex11AsyncResult.cs
- SByte.cs
- ThemeableAttribute.cs
- WebSysDefaultValueAttribute.cs
- ProxySimple.cs
- DataGridViewSelectedCellsAccessibleObject.cs
- CoreChannel.cs
- SerializationBinder.cs
- DataGridViewColumnCollection.cs
- ReachDocumentPageSerializerAsync.cs
- WebPartUtil.cs
- AsymmetricSignatureDeformatter.cs
- StrongNameMembershipCondition.cs
- BuilderPropertyEntry.cs
- ClientSettingsStore.cs
- DrawListViewColumnHeaderEventArgs.cs
- SelfIssuedAuthProofToken.cs
- _ListenerAsyncResult.cs
- AnalyzedTree.cs
- StylusSystemGestureEventArgs.cs
- DataGridViewRowCollection.cs
- SizeConverter.cs
- DefaultBinder.cs
- FontWeightConverter.cs
- OrderedDictionary.cs
- BehaviorDragDropEventArgs.cs
- BuilderPropertyEntry.cs
- Missing.cs
- ReadOnlyAttribute.cs
- FontEmbeddingManager.cs
- ContextStaticAttribute.cs
- relpropertyhelper.cs
- ColumnHeaderCollectionEditor.cs
- InteropEnvironment.cs
- PackWebRequestFactory.cs
- ProxyFragment.cs
- Rule.cs
- TreeViewItemAutomationPeer.cs
- Encoding.cs
- PrintControllerWithStatusDialog.cs
- Certificate.cs
- UpdatePanel.cs
- ActivatableWorkflowsQueryResult.cs
- WriteableBitmap.cs
- DynamicUpdateCommand.cs
- StreamInfo.cs
- ParallelTimeline.cs
- SafeIUnknown.cs
- VerbConverter.cs
- DockingAttribute.cs
- SqlExpander.cs
- ToolStripTextBox.cs
- XamlToRtfWriter.cs
- XmlSchemaGroup.cs
- SharedStatics.cs
- IISUnsafeMethods.cs
- DataGridViewColumnStateChangedEventArgs.cs
- GenerateScriptTypeAttribute.cs
- Root.cs
- DataGridViewComboBoxEditingControl.cs
- WindowsBrush.cs
- IndentedWriter.cs
- ScaleTransform3D.cs
- SignatureHelper.cs
- ClientBuildManager.cs
- SerializationSectionGroup.cs
- SHA512.cs
- ShutDownListener.cs
- DoubleUtil.cs
- DataBindingHandlerAttribute.cs
- Slider.cs
- BidPrivateBase.cs
- DocComment.cs
- XmlSchemaParticle.cs
- OdbcConnectionStringbuilder.cs
- ADMembershipUser.cs
- HebrewCalendar.cs
- UInt32.cs
- Point3DAnimationBase.cs
- Gdiplus.cs
- WinCategoryAttribute.cs
- ClientType.cs
- DataGridViewButtonColumn.cs
- ConfigurationManager.cs
- TemplateBindingExpressionConverter.cs
- TablePattern.cs
- TdsRecordBufferSetter.cs
- TimeIntervalCollection.cs
- RectangleGeometry.cs
- ArgumentReference.cs
- ThicknessConverter.cs
- StateManagedCollection.cs
- BinHexDecoder.cs
- DataServiceQueryProvider.cs
- OperationGenerator.cs
- XmlSchemaValidationException.cs