Code:
/ DotNET / DotNET / 8.0 / untmp / WIN_WINDOWS / lh_tools_devdiv_wpf / Windows / wcp / Framework / System / Windows / Automation / Peers / StatusBarAutomationPeer.cs / 1 / StatusBarAutomationPeer.cs
using System; using System.Collections; using System.Collections.Generic; using System.Runtime.InteropServices; using System.Security; using System.Text; using System.Windows; using System.Windows.Automation.Provider; using System.Windows.Controls; using System.Windows.Controls.Primitives; using System.Windows.Interop; using System.Windows.Media; using MS.Internal; using MS.Win32; namespace System.Windows.Automation.Peers { /// public class StatusBarAutomationPeer : FrameworkElementAutomationPeer { /// public StatusBarAutomationPeer(StatusBar owner): base(owner) {} /// protected override string GetClassNameCore() { return "StatusBar"; } /// protected override AutomationControlType GetAutomationControlTypeCore() { return AutomationControlType.StatusBar; } /// protected override ListGetChildrenCore() { List list = new List (); ItemsControl itemscontrol = Owner as ItemsControl; if (itemscontrol != null) { foreach (object obj in itemscontrol.Items) { if (obj is Separator) { Separator separator = obj as Separator; list.Add(UIElementAutomationPeer.CreatePeerForElement(separator)); } else { StatusBarItem item = itemscontrol.ItemContainerGenerator.ContainerFromItem(obj) as StatusBarItem; if (item != null) { //If the item is a string or TextBlock or StatusBarItem //StatusBarItemAutomationPeer will be created to show the text //Or we'll use the control's automation peer if (obj is string || obj is TextBlock || (obj is StatusBarItem && ((StatusBarItem)obj).Content is string)) { list.Add(UIElementAutomationPeer.CreatePeerForElement(item)); } else { List childList = GetChildrenAutomationPeer(item); if (childList != null) { foreach (AutomationPeer ap in childList) { list.Add(ap); } } } } } } } return list; } /// /// Get the children of the parent which has automation peer /// private ListGetChildrenAutomationPeer(Visual parent) { Invariant.Assert(parent != null); List children = null; iterate(parent, (IteratorCallback)delegate(AutomationPeer peer) { if (children == null) children = new List (); children.Add(peer); return (false); }); return children; } private delegate bool IteratorCallback(AutomationPeer peer); // private static bool iterate(Visual parent, IteratorCallback callback) { bool done = false; AutomationPeer peer = null; int count = parent.InternalVisualChildrenCount; for (int i = 0; i < count && !done; i++) { Visual child = parent.InternalGetVisualChild(i); if (child != null && child.CheckFlagsAnd(VisualFlags.IsUIElement) && (peer = CreatePeerForElement((UIElement)child)) != null) { done = callback(peer); } else { done = iterate(child, callback); } } return (done); } } } // 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
- ContentTypeSettingDispatchMessageFormatter.cs
- CDSsyncETWBCLProvider.cs
- ConnectionStringsSection.cs
- WindowsGraphics.cs
- GuidConverter.cs
- DatagridviewDisplayedBandsData.cs
- Part.cs
- ZipArchive.cs
- ContentElement.cs
- ExpandCollapseProviderWrapper.cs
- Int64KeyFrameCollection.cs
- TableLayoutCellPaintEventArgs.cs
- FlowDocumentFormatter.cs
- ServiceNotStartedException.cs
- NumericUpDownAccelerationCollection.cs
- HotSpotCollection.cs
- RadioButtonRenderer.cs
- SendKeys.cs
- SmiContext.cs
- SafeArchiveContext.cs
- CharKeyFrameCollection.cs
- UpdatePanel.cs
- NativeMethods.cs
- PersonalizationStateQuery.cs
- ComplexObject.cs
- ConstraintStruct.cs
- EdmError.cs
- DataExchangeServiceBinder.cs
- TextSerializer.cs
- DataObjectEventArgs.cs
- CellQuery.cs
- smtpconnection.cs
- NavigationPropertyEmitter.cs
- AuthorizationRuleCollection.cs
- BezierSegment.cs
- DataSourceCacheDurationConverter.cs
- RC2.cs
- X509ThumbprintKeyIdentifierClause.cs
- SelectionManager.cs
- GrammarBuilderBase.cs
- MessageFilter.cs
- QueryPageSettingsEventArgs.cs
- ActivityCodeGenerator.cs
- DataStorage.cs
- FileLevelControlBuilderAttribute.cs
- SQLDecimalStorage.cs
- TabItemWrapperAutomationPeer.cs
- Baml2006KeyRecord.cs
- ApplicationSettingsBase.cs
- SoapAttributes.cs
- ExpressionBindingCollection.cs
- FontFamily.cs
- WebPartConnectionsEventArgs.cs
- MaskInputRejectedEventArgs.cs
- DelegateOutArgument.cs
- FtpRequestCacheValidator.cs
- SimpleType.cs
- sqlpipe.cs
- ButtonBaseDesigner.cs
- CollectionContainer.cs
- Expression.cs
- HybridWebProxyFinder.cs
- InstanceCreationEditor.cs
- HttpHeaderCollection.cs
- BitVector32.cs
- StateInitialization.cs
- ZipArchive.cs
- SupportsEventValidationAttribute.cs
- CreateUserErrorEventArgs.cs
- QilStrConcat.cs
- MessageSmuggler.cs
- TimeSpanValidator.cs
- SecureEnvironment.cs
- SafeThemeHandle.cs
- NetTcpSecurityElement.cs
- GeneralTransform2DTo3DTo2D.cs
- CannotUnloadAppDomainException.cs
- RegexBoyerMoore.cs
- TranslateTransform3D.cs
- KeyFrames.cs
- TableLayoutRowStyleCollection.cs
- ForAllOperator.cs
- InputLanguageCollection.cs
- RewritingProcessor.cs
- DataBoundControl.cs
- Empty.cs
- _ContextAwareResult.cs
- ValuePattern.cs
- VectorAnimationUsingKeyFrames.cs
- Win32.cs
- WebRequestModuleElementCollection.cs
- EastAsianLunisolarCalendar.cs
- ThreadExceptionDialog.cs
- ObsoleteAttribute.cs
- ExceptionHandler.cs
- Vector3dCollection.cs
- ObjectDataSourceView.cs
- SqlTrackingWorkflowInstance.cs
- DateTimeConverter.cs
- Resources.Designer.cs