Code:
/ DotNET / DotNET / 8.0 / untmp / WIN_WINDOWS / lh_tools_devdiv_wpf / Windows / wcp / Framework / System / Windows / Controls / GroupItem.cs / 1 / GroupItem.cs
//---------------------------------------------------------------------------- // //// Copyright (C) Microsoft Corporation. All rights reserved. // // // Description: GroupItem object - root of the UI subtree generated for a CollectionViewGroup // // Specs: [....]/connecteddata/M5%20General%20Docs/Data%20Styling.mht // //--------------------------------------------------------------------------- using System; using System.Collections; namespace System.Windows.Controls { ////// A GroupItem appears as the root of the visual subtree generated for a CollectionViewGroup. /// public class GroupItem : ContentControl { static GroupItem() { DefaultStyleKeyProperty.OverrideMetadata(typeof(GroupItem), new FrameworkPropertyMetadata(typeof(GroupItem))); _dType = DependencyObjectType.FromSystemTypeInternal(typeof(GroupItem)); // GroupItems should not be focusable by default FocusableProperty.OverrideMetadata(typeof(GroupItem), new FrameworkPropertyMetadata(false)); } ////// Creates AutomationPeer ( protected override System.Windows.Automation.Peers.AutomationPeer OnCreateAutomationPeer() { return new System.Windows.Automation.Peers.GroupItemAutomationPeer(this); } ///) /// /// Gives a string representation of this object. /// ///internal override string GetPlainText() { System.Windows.Data.CollectionViewGroup cvg = Content as System.Windows.Data.CollectionViewGroup; if (cvg != null) { return cvg.Name.ToString(); } return base.GetPlainText(); } //----------------------------------------------------- // // Internal Properties // //----------------------------------------------------- internal ItemContainerGenerator Generator { get { return _generator; } set { _generator = value; } } //------------------------------------------------------ // // Internal Methods // //----------------------------------------------------- internal void PrepareItemContainer(object item) { ItemContainerGenerator generator = Generator.Parent; GroupStyle groupStyle = generator.GroupStyle; // apply the container style Style style = groupStyle.ContainerStyle; // no ContainerStyle set, try ContainerStyleSelector if (style == null) { if (groupStyle.ContainerStyleSelector != null) { style = groupStyle.ContainerStyleSelector.SelectStyle(item, this); } } // apply the style, if found if (style != null) { // verify style is appropriate before applying it if (!style.TargetType.IsInstanceOfType(this)) throw new InvalidOperationException(SR.Get(SRID.StyleForWrongType, style.TargetType.Name, this.GetType().Name)); this.Style = style; this.WriteInternalFlag2(InternalFlags2.IsStyleSetFromGenerator, true); } // forward the header template information if (!HasNonDefaultValue(ContentProperty)) this.Content = item; if (!HasNonDefaultValue(ContentTemplateProperty)) this.ContentTemplate = groupStyle.HeaderTemplate; if (!HasNonDefaultValue(ContentTemplateSelectorProperty)) this.ContentTemplateSelector = groupStyle.HeaderTemplateSelector; } internal void ClearContainerForItem(object item) { ItemContainerGenerator generator = Generator.Parent; GroupStyle groupStyle = generator.GroupStyle; if (Object.Equals(this.Content, item)) ClearValue(ContentProperty); if (this.ContentTemplate == groupStyle.HeaderTemplate) ClearValue(ContentTemplateProperty); if (this.ContentTemplateSelector == groupStyle.HeaderTemplateSelector) ClearValue(ContentTemplateSelectorProperty); Generator.Release(); } //------------------------------------------------------ // // Private Fields // //------------------------------------------------------ ItemContainerGenerator _generator; #region DTypeThemeStyleKey // Returns the DependencyObjectType for the registered ThemeStyleKey's default // value. Controls will override this method to return approriate types. internal override DependencyObjectType DTypeThemeStyleKey { get { return _dType; } } private static DependencyObjectType _dType; #endregion DTypeThemeStyleKey } } // 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
- KnownColorTable.cs
- ToolBarButton.cs
- Timeline.cs
- WorkingDirectoryEditor.cs
- SafeCoTaskMem.cs
- NGCSerializationManager.cs
- XmlParserContext.cs
- WebPartEditorApplyVerb.cs
- MarshalByRefObject.cs
- SpeechSeg.cs
- RuleAction.cs
- HttpResponseBase.cs
- CodeEntryPointMethod.cs
- RectangleGeometry.cs
- ExceptionAggregator.cs
- ServiceDescriptionData.cs
- BufferModeSettings.cs
- ArraySet.cs
- HtmlTextBoxAdapter.cs
- Function.cs
- ResourceAttributes.cs
- RMEnrollmentPage2.cs
- OdbcEnvironment.cs
- WebPartTracker.cs
- AccessDataSource.cs
- HttpTransportManager.cs
- StylusPlugin.cs
- PrintDialogException.cs
- _SslState.cs
- Soap12ServerProtocol.cs
- QueryInterceptorAttribute.cs
- PropertyGridEditorPart.cs
- Constants.cs
- StringUtil.cs
- ListItemsCollectionEditor.cs
- AssemblyBuilderData.cs
- PrintDialogException.cs
- FlowDocument.cs
- HighlightVisual.cs
- SerializationInfoEnumerator.cs
- ExternalDataExchangeClient.cs
- WindowsStatusBar.cs
- CodeMemberEvent.cs
- SQLDouble.cs
- DataFormats.cs
- AsyncSerializedWorker.cs
- OracleDataAdapter.cs
- CompilerErrorCollection.cs
- ScrollViewer.cs
- ResourceProperty.cs
- CacheEntry.cs
- FormsIdentity.cs
- DesignerPerfEventProvider.cs
- HtmlMeta.cs
- TypeInitializationException.cs
- TaskFileService.cs
- FontFamilyValueSerializer.cs
- DataChangedEventManager.cs
- Grammar.cs
- DefinitionBase.cs
- NegotiationTokenProvider.cs
- TypeForwardedToAttribute.cs
- DataServiceRequestOfT.cs
- Configuration.cs
- TagPrefixInfo.cs
- SvcMapFileLoader.cs
- ToolboxControl.cs
- BuildProviderAppliesToAttribute.cs
- UnsafePeerToPeerMethods.cs
- XmlDesigner.cs
- VisualTarget.cs
- ToolStripStatusLabel.cs
- FlowDecision.cs
- Bidi.cs
- IconConverter.cs
- BuildManager.cs
- PropertiesTab.cs
- ApplicationFileParser.cs
- HostedController.cs
- DataObjectSettingDataEventArgs.cs
- TrackingProfileDeserializationException.cs
- ToolboxComponentsCreatedEventArgs.cs
- MimeFormImporter.cs
- ProfileSettings.cs
- XmlNullResolver.cs
- FilterEventArgs.cs
- DataGridRelationshipRow.cs
- XmlIterators.cs
- SymDocumentType.cs
- Tuple.cs
- XmlAutoDetectWriter.cs
- WebResourceAttribute.cs
- FixedSOMPageConstructor.cs
- Control.cs
- QueryContinueDragEventArgs.cs
- SystemIPInterfaceStatistics.cs
- TemplateControl.cs
- StreamingContext.cs
- ImageIndexConverter.cs
- ProgramPublisher.cs