Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / wpf / src / Framework / System / Windows / Automation / Peers / FlowDocumentScrollViewerAutomationPeer.cs / 1 / FlowDocumentScrollViewerAutomationPeer.cs
//---------------------------------------------------------------------------- // // Copyright (C) Microsoft Corporation. All rights reserved. // // File: FlowDocumentScrollViewerAutomationPeer.cs // // Description: AutomationPeer associated with FlowDocumentScrollViewer. // //--------------------------------------------------------------------------- using System.Collections.Generic; // Listusing System.Windows.Automation.Provider; // IScrollProvider using System.Windows.Controls; // FlowDocumentScrollViewer using System.Windows.Documents; // FlowDocument using MS.Internal.Documents; // IFlowDocumentViewer namespace System.Windows.Automation.Peers { /// /// AutomationPeer associated with FlowDocumentScrollViewer. /// public class FlowDocumentScrollViewerAutomationPeer : FrameworkElementAutomationPeer { ////// Constructor. /// /// Owner of the AutomationPeer. public FlowDocumentScrollViewerAutomationPeer(FlowDocumentScrollViewer owner) : base(owner) { } ////// public override object GetPattern(PatternInterface patternInterface) { object returnValue = null; if (patternInterface == PatternInterface.Scroll) { FlowDocumentScrollViewer owner = (FlowDocumentScrollViewer)Owner; if (owner.ScrollViewer != null) { AutomationPeer scrollPeer = UIElementAutomationPeer.CreatePeerForElement(owner.ScrollViewer); if (scrollPeer != null && scrollPeer is IScrollProvider) { scrollPeer.EventsSource = this; returnValue = scrollPeer; } } } else 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 FlowDocumentScrollViewer 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(); // If the owner is IFlowDocumentViewer, it means that it is embedded inside // FlowDocumentReaer. In this case DocumentAutumationPeer is already exposed. // Hence there is no need to add it to children collection. if (!(Owner is IFlowDocumentViewer)) { // Add AutomationPeer associated with the document. // Make it the first child of the collection. FlowDocument document = ((FlowDocumentScrollViewer)Owner).Document; if (document != null) { AutomationPeer documentPeer = ContentElementAutomationPeer.CreatePeerForElement(document); 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 "FlowDocumentScrollViewer"; } 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: FlowDocumentScrollViewerAutomationPeer.cs // // Description: AutomationPeer associated with FlowDocumentScrollViewer. // //--------------------------------------------------------------------------- using System.Collections.Generic; // List/// using System.Windows.Automation.Provider; // IScrollProvider using System.Windows.Controls; // FlowDocumentScrollViewer using System.Windows.Documents; // FlowDocument using MS.Internal.Documents; // IFlowDocumentViewer namespace System.Windows.Automation.Peers { /// /// AutomationPeer associated with FlowDocumentScrollViewer. /// public class FlowDocumentScrollViewerAutomationPeer : FrameworkElementAutomationPeer { ////// Constructor. /// /// Owner of the AutomationPeer. public FlowDocumentScrollViewerAutomationPeer(FlowDocumentScrollViewer owner) : base(owner) { } ////// public override object GetPattern(PatternInterface patternInterface) { object returnValue = null; if (patternInterface == PatternInterface.Scroll) { FlowDocumentScrollViewer owner = (FlowDocumentScrollViewer)Owner; if (owner.ScrollViewer != null) { AutomationPeer scrollPeer = UIElementAutomationPeer.CreatePeerForElement(owner.ScrollViewer); if (scrollPeer != null && scrollPeer is IScrollProvider) { scrollPeer.EventsSource = this; returnValue = scrollPeer; } } } else 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 FlowDocumentScrollViewer 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(); // If the owner is IFlowDocumentViewer, it means that it is embedded inside // FlowDocumentReaer. In this case DocumentAutumationPeer is already exposed. // Hence there is no need to add it to children collection. if (!(Owner is IFlowDocumentViewer)) { // Add AutomationPeer associated with the document. // Make it the first child of the collection. FlowDocument document = ((FlowDocumentScrollViewer)Owner).Document; if (document != null) { AutomationPeer documentPeer = ContentElementAutomationPeer.CreatePeerForElement(document); 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 "FlowDocumentScrollViewer"; } 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
- EntityWrapper.cs
- OptimisticConcurrencyException.cs
- SystemColorTracker.cs
- DialogResultConverter.cs
- mactripleDES.cs
- ContentElementCollection.cs
- DataGridViewImageColumn.cs
- SafeNativeMethods.cs
- RuntimeCompatibilityAttribute.cs
- SchemaElementDecl.cs
- TypePropertyEditor.cs
- LocalValueEnumerator.cs
- DSACryptoServiceProvider.cs
- DbReferenceCollection.cs
- CacheMemory.cs
- PolyQuadraticBezierSegment.cs
- TextParagraphProperties.cs
- ServiceInfoCollection.cs
- InternalTransaction.cs
- ApplicationServiceManager.cs
- DeleteCardRequest.cs
- DrawingVisual.cs
- DocumentGridPage.cs
- SoapIncludeAttribute.cs
- panel.cs
- NegationPusher.cs
- XsltLoader.cs
- GroupStyle.cs
- handlecollector.cs
- BindableAttribute.cs
- SignHashRequest.cs
- ImageFormat.cs
- MethodBuilder.cs
- Timeline.cs
- FixedSOMImage.cs
- ViewValidator.cs
- Typeface.cs
- backend.cs
- IndentTextWriter.cs
- BamlResourceDeserializer.cs
- JsonXmlDataContract.cs
- LongValidatorAttribute.cs
- OleTxTransactionInfo.cs
- RenderData.cs
- TreeNodeClickEventArgs.cs
- LOSFormatter.cs
- CodeMethodReturnStatement.cs
- EndEvent.cs
- TextFormatterContext.cs
- UpdateCommandGenerator.cs
- HitTestParameters3D.cs
- NamespaceCollection.cs
- RowSpanVector.cs
- WebServiceEndpoint.cs
- XmlFormatExtensionPointAttribute.cs
- UrlPropertyAttribute.cs
- ConvertEvent.cs
- ParagraphResult.cs
- StringUtil.cs
- Configuration.cs
- DataGridHeaderBorder.cs
- PopupEventArgs.cs
- Function.cs
- SessionPageStatePersister.cs
- DataGridViewRowPostPaintEventArgs.cs
- DataBoundControlHelper.cs
- DataViewSetting.cs
- SqlConnectionPoolGroupProviderInfo.cs
- DesignTimeResourceProviderFactoryAttribute.cs
- ColumnMapProcessor.cs
- OleDbParameterCollection.cs
- TableHeaderCell.cs
- ToolStripRenderEventArgs.cs
- SoapExtension.cs
- GradientBrush.cs
- GridViewSelectEventArgs.cs
- DbParameterHelper.cs
- SecondaryIndexList.cs
- ToolStripRendererSwitcher.cs
- OracleParameterCollection.cs
- PointUtil.cs
- FixedSOMTableRow.cs
- PrimitiveDataContract.cs
- OdbcFactory.cs
- OdbcConnectionFactory.cs
- SimpleType.cs
- DataServiceKeyAttribute.cs
- Model3DCollection.cs
- URLBuilder.cs
- TreeNodeClickEventArgs.cs
- ExpressionVisitor.cs
- RichTextBoxAutomationPeer.cs
- ellipse.cs
- XmlSerializableReader.cs
- Keywords.cs
- PtsPage.cs
- sqlstateclientmanager.cs
- StatementContext.cs
- RuleValidation.cs
- WinEventHandler.cs