Code:
/ 4.0 / 4.0 / untmp / 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.///
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ListControlBoundActionList.cs
- XmlObjectSerializerReadContext.cs
- DataGridViewTopLeftHeaderCell.cs
- SafeRegistryHandle.cs
- XpsSerializationException.cs
- GridErrorDlg.cs
- GestureRecognizer.cs
- RangeBase.cs
- PixelShader.cs
- MatchingStyle.cs
- MethodMessage.cs
- ConnectionPoolManager.cs
- InputBinding.cs
- Configuration.cs
- IItemContainerGenerator.cs
- ScrollContentPresenter.cs
- IgnoreFileBuildProvider.cs
- ExpressionPrinter.cs
- SystemNetHelpers.cs
- RefreshPropertiesAttribute.cs
- HttpModuleAction.cs
- BinaryVersion.cs
- SqlExpressionNullability.cs
- SudsWriter.cs
- OciEnlistContext.cs
- PlatformCulture.cs
- CheckBoxPopupAdapter.cs
- CollectionViewGroupRoot.cs
- SimpleModelProvider.cs
- ListViewItemSelectionChangedEvent.cs
- PreviewPrintController.cs
- DotAtomReader.cs
- ImageFormat.cs
- TextServicesPropertyRanges.cs
- ToolBarTray.cs
- HttpBrowserCapabilitiesBase.cs
- DataSourceHelper.cs
- SetterBaseCollection.cs
- Visual.cs
- HttpCapabilitiesBase.cs
- IgnoreSectionHandler.cs
- LayoutTable.cs
- ZipIOZip64EndOfCentralDirectoryBlock.cs
- EncoderParameter.cs
- XmlAttributeHolder.cs
- ControlAdapter.cs
- RuleSettings.cs
- TreeViewDesigner.cs
- FileFormatException.cs
- CriticalExceptions.cs
- TrayIconDesigner.cs
- SQLSingleStorage.cs
- recordstate.cs
- GridViewPageEventArgs.cs
- DbConnectionPoolCounters.cs
- RowBinding.cs
- ColorContext.cs
- EntityException.cs
- RichTextBoxConstants.cs
- Util.cs
- SqlGenerator.cs
- WorkflowDebuggerSteppingAttribute.cs
- clipboard.cs
- UmAlQuraCalendar.cs
- CustomError.cs
- MissingMemberException.cs
- KeyTime.cs
- PolicyStatement.cs
- FindCriteriaElement.cs
- ProgressChangedEventArgs.cs
- ProcessInputEventArgs.cs
- SerializationBinder.cs
- Matrix3DValueSerializer.cs
- NameHandler.cs
- GridItemPattern.cs
- BoundingRectTracker.cs
- FixedSOMTextRun.cs
- SmiEventSink.cs
- OperationFormatStyle.cs
- GlobalItem.cs
- DtdParser.cs
- TrustExchangeException.cs
- ScriptReferenceEventArgs.cs
- _LocalDataStoreMgr.cs
- UnmanagedBitmapWrapper.cs
- _SSPIWrapper.cs
- SharedPersonalizationStateInfo.cs
- EntitySet.cs
- GiveFeedbackEventArgs.cs
- SchemaCreator.cs
- ParseNumbers.cs
- DesignerHost.cs
- TypeConverterHelper.cs
- Multiply.cs
- KeyGestureValueSerializer.cs
- SeparatorAutomationPeer.cs
- ZipIORawDataFileBlock.cs
- SqlFileStream.cs
- AbandonedMutexException.cs
- ClientUtils.cs