Code:
/ DotNET / DotNET / 8.0 / untmp / WIN_WINDOWS / lh_tools_devdiv_wpf / Windows / wcp / 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.///
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- DataGridViewAddColumnDialog.cs
- DefaultPrintController.cs
- QilBinary.cs
- DataGridView.cs
- HandledEventArgs.cs
- ObjectDataSourceStatusEventArgs.cs
- RepeatBehaviorConverter.cs
- WebPartZoneCollection.cs
- ResumeStoryboard.cs
- XmlTextReaderImplHelpers.cs
- StateChangeEvent.cs
- SystemIPGlobalProperties.cs
- TypeElement.cs
- ManagedIStream.cs
- DESCryptoServiceProvider.cs
- ExtenderProvidedPropertyAttribute.cs
- DependencyPropertyAttribute.cs
- XmlComment.cs
- PageParserFilter.cs
- OutputScope.cs
- OperationValidationEventArgs.cs
- Parsers.cs
- RequestSecurityTokenResponse.cs
- PolyBezierSegment.cs
- XmlObjectSerializerWriteContextComplexJson.cs
- Persist.cs
- LayoutTableCell.cs
- TraceSource.cs
- WindowsButton.cs
- PointAnimationBase.cs
- DispatcherFrame.cs
- BitmapEffectGroup.cs
- PathBox.cs
- MaterialCollection.cs
- QueryOperatorEnumerator.cs
- BeginEvent.cs
- XmlSerializationWriter.cs
- RelatedCurrencyManager.cs
- BinaryParser.cs
- ToolBarPanel.cs
- FixedSOMLineRanges.cs
- DetailsViewDeleteEventArgs.cs
- OleDbErrorCollection.cs
- DockingAttribute.cs
- WindowsButton.cs
- WSSecurityPolicy11.cs
- OleDbWrapper.cs
- DataGridViewCellCollection.cs
- NumericPagerField.cs
- StaticResourceExtension.cs
- ResourceProviderFactory.cs
- QilLiteral.cs
- ToolStripSeparator.cs
- AuthorizationRuleCollection.cs
- _emptywebproxy.cs
- StructuredTypeInfo.cs
- VirtualDirectoryMapping.cs
- TextElement.cs
- BamlRecordHelper.cs
- MarshalByRefObject.cs
- SapiInterop.cs
- CalculatedColumn.cs
- RSAPKCS1KeyExchangeDeformatter.cs
- SmtpFailedRecipientsException.cs
- HorizontalAlignConverter.cs
- DataBindingExpressionBuilder.cs
- StateRuntime.cs
- SafeEventLogWriteHandle.cs
- UserNameSecurityTokenProvider.cs
- Attributes.cs
- Variant.cs
- TableAutomationPeer.cs
- entitydatasourceentitysetnameconverter.cs
- Journal.cs
- RadioButtonRenderer.cs
- FormView.cs
- SqlError.cs
- COM2PropertyDescriptor.cs
- XmlDataSourceView.cs
- PeerConnector.cs
- HelpEvent.cs
- HandleRef.cs
- MenuItemStyleCollection.cs
- JapaneseCalendar.cs
- MethodBuilder.cs
- DebugView.cs
- DataObjectCopyingEventArgs.cs
- _WinHttpWebProxyDataBuilder.cs
- FlowchartDesigner.Helpers.cs
- GradientSpreadMethodValidation.cs
- MenuEventArgs.cs
- BindingWorker.cs
- ToolStripEditorManager.cs
- VisualStyleElement.cs
- XslVisitor.cs
- StorageMappingItemLoader.cs
- SecurityPermission.cs
- TextBox.cs
- TypeUnloadedException.cs
- _TransmitFileOverlappedAsyncResult.cs