Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / wpf / src / Framework / System / Windows / Automation / Peers / FlowDocumentScrollViewerAutomationPeer.cs / 1305600 / 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); } } else if (patternInterface == PatternInterface.SynchronizedInput) { returnValue = base.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); } } else if (patternInterface == PatternInterface.SynchronizedInput) { returnValue = base.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
- TimeSpanFormat.cs
- XsltOutput.cs
- GridViewRowCollection.cs
- FixedSOMSemanticBox.cs
- InputReportEventArgs.cs
- TemplatedAdorner.cs
- ISCIIEncoding.cs
- ViewPort3D.cs
- DeferredSelectedIndexReference.cs
- WsiProfilesElement.cs
- XmlCharCheckingWriter.cs
- WriteFileContext.cs
- CompilationUtil.cs
- StylusSystemGestureEventArgs.cs
- WebRequestModuleElement.cs
- Preprocessor.cs
- TreeNode.cs
- SvcMapFile.cs
- ConversionContext.cs
- HtmlInputCheckBox.cs
- UndirectedGraph.cs
- SrgsDocumentParser.cs
- DeleteCardRequest.cs
- IApplicationTrustManager.cs
- SmiEventStream.cs
- XmlWrappingReader.cs
- PolyQuadraticBezierSegment.cs
- InheritanceAttribute.cs
- Comparer.cs
- PrivateUnsafeNativeCompoundFileMethods.cs
- Rfc2898DeriveBytes.cs
- SafeProcessHandle.cs
- SqlStream.cs
- UnsafeMethods.cs
- UserNameSecurityTokenAuthenticator.cs
- WizardForm.cs
- WebConvert.cs
- SwitchLevelAttribute.cs
- RemoteWebConfigurationHost.cs
- BuiltInExpr.cs
- FixedPageProcessor.cs
- AssemblyBuilder.cs
- Logging.cs
- Transaction.cs
- CodeMemberMethod.cs
- BaseProcessor.cs
- SerializationInfoEnumerator.cs
- XmlSchemaChoice.cs
- TreeViewCancelEvent.cs
- XmlBindingWorker.cs
- XmlSchemaElement.cs
- RecommendedAsConfigurableAttribute.cs
- QueryParameter.cs
- WindowsListViewSubItem.cs
- AliasedExpr.cs
- CheckBoxBaseAdapter.cs
- SoapAttributeOverrides.cs
- EntitySqlException.cs
- FileNameEditor.cs
- CaseInsensitiveOrdinalStringComparer.cs
- ProvidersHelper.cs
- PathNode.cs
- Matrix3DConverter.cs
- ToolStripSettings.cs
- BitmapImage.cs
- GuidTagList.cs
- FontEmbeddingManager.cs
- ActivityDesignerHighlighter.cs
- Bits.cs
- XmlWriterTraceListener.cs
- IgnoreSectionHandler.cs
- ParallelActivityDesigner.cs
- ExpressionBuilderCollection.cs
- HttpStreamFormatter.cs
- PointHitTestResult.cs
- RenderOptions.cs
- DurableInstance.cs
- ImmutableObjectAttribute.cs
- TranslateTransform.cs
- EnumDataContract.cs
- OleDbFactory.cs
- LoadMessageLogger.cs
- ProcessModule.cs
- RuleCache.cs
- RemoteWebConfigurationHost.cs
- PathSegment.cs
- ConnectionPoolManager.cs
- InstanceCompleteException.cs
- ListenerConfig.cs
- ForceCopyBuildProvider.cs
- LabelLiteral.cs
- _LoggingObject.cs
- MatrixAnimationBase.cs
- DocumentPaginator.cs
- BCryptSafeHandles.cs
- CmsInterop.cs
- Events.cs
- EncoderBestFitFallback.cs
- BufferedGraphicsContext.cs
- WindowsRegion.cs