Code:
/ DotNET / DotNET / 8.0 / untmp / WIN_WINDOWS / lh_tools_devdiv_wpf / Windows / wcp / Framework / System / Windows / Automation / Peers / GridViewItemAutomationPeer.cs / 1 / GridViewItemAutomationPeer.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; 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 GridViewItemAutomationPeer : ListBoxItemAutomationPeer { /// public GridViewItemAutomationPeer(object owner, ListViewAutomationPeer listviewAP) : base(owner, listviewAP) { Invariant.Assert(owner != null); Invariant.Assert(listviewAP != null); _item = owner; _listviewAP = listviewAP; } /// override protected string GetClassNameCore() { return "ListViewItem"; } /// override protected AutomationControlType GetAutomationControlTypeCore() { return AutomationControlType.DataItem; } /// protected override ListGetChildrenCore() { ListView listview = _listviewAP.Owner as ListView; Invariant.Assert(listview != null); ListViewItem lvi = listview.ItemContainerGenerator.ContainerFromItem(_item) as ListViewItem; if (lvi != null) { GridViewRowPresenter rowPresenter = GridViewAutomationPeer.FindVisualByType(lvi, typeof(GridViewRowPresenter)) as GridViewRowPresenter; if (rowPresenter != null) { Hashtable oldChildren = _dataChildren; //cache the old ones for possible reuse _dataChildren = new Hashtable(rowPresenter.ActualCells.Count); List list = new List (); int row = listview.Items.IndexOf(_item); int column = 0; foreach (UIElement ele in rowPresenter.ActualCells) { GridViewCellAutomationPeer peer = (oldChildren == null ? null : (GridViewCellAutomationPeer)oldChildren[ele]); if (peer == null) { if (ele is ContentPresenter) { peer = new GridViewCellAutomationPeer((ContentPresenter)ele, _listviewAP); } else if (ele is TextBlock) { peer = new GridViewCellAutomationPeer((TextBlock)ele, _listviewAP); } else { Invariant.Assert(false, "Children of GridViewRowPresenter should be ContentPresenter or TextBlock"); } } //protection from indistinguishable UIElement - for example, 2 UIElement wiht same value if (_dataChildren[ele] == null) { //Set Cell's row and column peer.Column = column; peer.Row = row; list.Add(peer); _dataChildren.Add(ele, peer); column++; } } return list; } } return null; } #region Private Fields private object _item; private ListViewAutomationPeer _listviewAP; private Hashtable _dataChildren = null; #endregion } } // 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
- ChildTable.cs
- OdbcError.cs
- CustomWebEventKey.cs
- RootBrowserWindowAutomationPeer.cs
- PolicyValidator.cs
- EdmComplexPropertyAttribute.cs
- ObjectStateManager.cs
- _Connection.cs
- MetaType.cs
- HeaderedContentControl.cs
- ComboBox.cs
- ConfigurationStrings.cs
- ColorDialog.cs
- FeatureSupport.cs
- XamlTypeMapper.cs
- ColumnHeaderCollectionEditor.cs
- StylusEditingBehavior.cs
- SiteMapDataSourceView.cs
- XomlCompilerResults.cs
- ImportOptions.cs
- RsaSecurityToken.cs
- SHA384.cs
- AgileSafeNativeMemoryHandle.cs
- BaseCAMarshaler.cs
- SafeEventHandle.cs
- RequestTimeoutManager.cs
- ControlParameter.cs
- TypeForwardedFromAttribute.cs
- DynamicMethod.cs
- ScriptResourceInfo.cs
- PaintEvent.cs
- DrawingContextDrawingContextWalker.cs
- CodeTypeDelegate.cs
- XmlDocumentViewSchema.cs
- CacheEntry.cs
- PartialTrustVisibleAssembly.cs
- NullableLongMinMaxAggregationOperator.cs
- CompatibleIComparer.cs
- WebPartConnectionsCancelVerb.cs
- BigInt.cs
- TraceContextEventArgs.cs
- ExtensionSurface.cs
- DragEventArgs.cs
- MenuItem.cs
- CqlLexerHelpers.cs
- HostExecutionContextManager.cs
- DropTarget.cs
- DataGridViewSelectedCellsAccessibleObject.cs
- InplaceBitmapMetadataWriter.cs
- BitmapEffectCollection.cs
- RootProfilePropertySettingsCollection.cs
- PropertyFilterAttribute.cs
- PointCollection.cs
- SpeakProgressEventArgs.cs
- SubMenuStyle.cs
- WebPartConnectionsConfigureVerb.cs
- LogicalTreeHelper.cs
- EntityTransaction.cs
- MachineKey.cs
- OfTypeExpression.cs
- SvcMapFile.cs
- TableRowCollection.cs
- RenderTargetBitmap.cs
- ContractListAdapter.cs
- PeerApplication.cs
- IProvider.cs
- ConvertEvent.cs
- RootBrowserWindow.cs
- COAUTHINFO.cs
- ListBindingConverter.cs
- PropertyInformationCollection.cs
- NullableIntMinMaxAggregationOperator.cs
- ProbeDuplex11AsyncResult.cs
- DoubleLinkList.cs
- ProcessThreadCollection.cs
- TableDesigner.cs
- IItemProperties.cs
- ObjectStorage.cs
- Propagator.cs
- fixedPageContentExtractor.cs
- HtmlShim.cs
- Rect.cs
- CodeTypeReferenceExpression.cs
- Attributes.cs
- BitmapEffectInput.cs
- MarshalByValueComponent.cs
- TrackBar.cs
- DataObjectFieldAttribute.cs
- SiteMapNode.cs
- SystemMulticastIPAddressInformation.cs
- XmlSchemaSequence.cs
- RoleManagerModule.cs
- XmlEncodedRawTextWriter.cs
- ConnectionPointCookie.cs
- DesignTimeVisibleAttribute.cs
- FixedSchema.cs
- Transform.cs
- RolePrincipal.cs
- DocumentAutomationPeer.cs
- AppDomainFactory.cs