Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / wpf / src / Framework / System / Windows / Controls / GridView.cs / 1 / GridView.cs
//----------------------------------------------------------------------------
//
// Copyright (C) Microsoft Corporation. All rights reserved.
//
//---------------------------------------------------------------------------
using System.ComponentModel; // DesignerSerializationVisibility
using System.Windows.Automation.Peers;
using System.Windows.Markup;
using System.Diagnostics; // Debug
using MS.Internal; // Helper
using MS.Internal.KnownBoxes;
namespace System.Windows.Controls
{
///
/// GridView is a built-in view of the ListView control. It is unique
/// from other built-in views because of its table-like layout. Data in
/// details view is shown in a table with each row corresponding to an
/// entity in the data collection and each column being generated from a
/// data-bound template, populated with values from the bound data entity.
///
[StyleTypedProperty(Property = "ColumnHeaderContainerStyle", StyleTargetType = typeof(System.Windows.Controls.GridViewColumnHeader))]
[ContentProperty("Columns")]
public class GridView : ViewBase, IAddChild
{
//-------------------------------------------------------------------
//
// Constructors
//
//-------------------------------------------------------------------
//--------------------------------------------------------------------
//
// Public Methods
//
//-------------------------------------------------------------------
#region Public Methods
///
/// Add an object child to this control
///
void IAddChild.AddChild(object column)
{
AddChild(column);
}
///
/// Add an object child to this control
///
protected virtual void AddChild(object column)
{
GridViewColumn c = column as GridViewColumn;
if (c != null)
{
Columns.Add(c);
}
else
{
throw new InvalidOperationException(SR.Get(SRID.ListView_IllegalChildrenType));
}
}
///
/// Add a text string to this control
///
void IAddChild.AddText(string text)
{
AddText(text);
}
///
/// Add a text string to this control
///
protected virtual void AddText(string text)
{
AddChild(text);
}
///
/// Returns a string representation of this object.
///
///
public override string ToString()
{
return SR.Get(SRID.ToStringFormatString_GridView, this.GetType(), Columns.Count);
}
///
/// called when ListView creates its Automation peer
/// GridView override this method to return a GridViewAutomationPeer
///
/// listview reference
/// GridView automation peer
internal protected override IViewAutomationPeer GetAutomationPeer(ListView parent)
{
return new GridViewAutomationPeer(this, parent);
}
#endregion
//--------------------------------------------------------------------
//
// Public Properties
//
//--------------------------------------------------------------------
#region Public Properties
// For all the DPs on GridView, null is treated as unset,
// because it's impossible to distinguish null and unset.
// Change a property between null and unset, PropertyChangedCallback will not be called.
// ---------------------------------------------------------------------------
// Defines the names of the resources to be consumed by the GridView style.
// Used to restyle several roles of GridView without having to restyle
// all of the control.
// ----------------------------------------------------------------------------
#region StyleKeys
///
/// Key used to mark the template of ScrollViewer for use by GridView
///
public static ResourceKey GridViewScrollViewerStyleKey
{
get
{
if (_scrollViewerStyleKey == null)
{
_scrollViewerStyleKey = new SystemThemeKey(SystemResourceKeyID.GridViewScrollViewerStyle);
}
return _scrollViewerStyleKey;
}
}
private static SystemThemeKey _scrollViewerStyleKey;
///
/// Key used to mark the Style of GridView
///
public static ResourceKey GridViewStyleKey
{
get
{
if (_gridViewStyleKey == null)
{
_gridViewStyleKey = new SystemThemeKey(SystemResourceKeyID.GridViewStyle);
}
return _gridViewStyleKey;
}
}
private static SystemThemeKey _gridViewStyleKey;
///
/// Key used to mark the Style of ItemContainer
///
public static ResourceKey GridViewItemContainerStyleKey
{
get
{
if (_gridViewItemContainerStyleKey == null)
{
_gridViewItemContainerStyleKey = new SystemThemeKey(SystemResourceKeyID.GridViewItemContainerStyle);
}
return _gridViewItemContainerStyleKey;
}
}
private static SystemThemeKey _gridViewItemContainerStyleKey;
#endregion StyleKeys
#region GridViewColumnCollection Attached DP
///
/// Reads the attached property GridViewColumnCollection from the given element.
///
/// The element from which to read the GridViewColumnCollection attached property.
/// The property's value.
public static GridViewColumnCollection GetColumnCollection(DependencyObject element)
{
if (element == null) { throw new ArgumentNullException("element"); }
return (GridViewColumnCollection)element.GetValue(ColumnCollectionProperty);
}
///
/// Writes the attached property GridViewColumnCollection to the given element.
///
/// The element to which to write the GridViewColumnCollection attached property.
/// The collection to set
public static void SetColumnCollection(DependencyObject element, GridViewColumnCollection collection)
{
if (element == null) { throw new ArgumentNullException("element"); }
element.SetValue(ColumnCollectionProperty, collection);
}
///
/// This is the dependency property registered for the GridView' ColumnCollection attached property.
///
public static readonly DependencyProperty ColumnCollectionProperty
= DependencyProperty.RegisterAttached(
"ColumnCollection",
typeof(GridViewColumnCollection),
typeof(GridView));
///
/// Whether should serialize ColumnCollection attach DP
///
/// Object on which this DP is set
[EditorBrowsable(EditorBrowsableState.Never)]
public static bool ShouldSerializeColumnCollection(DependencyObject obj)
{
ListViewItem listViewItem = obj as ListViewItem;
if (listViewItem != null)
{
ListView listView = listViewItem.ParentSelector as ListView;
if (listView != null)
{
GridView gridView = listView.View as GridView;
if (gridView != null)
{
// if GridViewColumnCollection attached on ListViewItem is Details.Columns, it should't be serialized.
GridViewColumnCollection localValue = listViewItem.ReadLocalValue(ColumnCollectionProperty) as GridViewColumnCollection;
return (localValue != gridView.Columns);
}
}
}
return true;
}
#endregion
/// GridViewColumn List
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
public GridViewColumnCollection Columns
{
get
{
if (_columns == null)
{
_columns = new GridViewColumnCollection();
// Give the collection a back-link, this is used for the inheritance context
_columns.Owner = this;
_columns.InViewMode = true;
}
return _columns;
}
}
#region ColumnHeaderContainerStyle
///
/// ColumnHeaderContainerStyleProperty DependencyProperty
///
public static readonly DependencyProperty ColumnHeaderContainerStyleProperty =
DependencyProperty.Register(
"ColumnHeaderContainerStyle",
typeof(Style),
typeof(GridView)
);
///
/// header container's style
///
public Style ColumnHeaderContainerStyle
{
get { return (Style)GetValue(ColumnHeaderContainerStyleProperty); }
set { SetValue(ColumnHeaderContainerStyleProperty, value); }
}
#endregion // ColumnHeaderContainerStyle
#region ColumnHeaderTemplate
///
/// ColumnHeaderTemplate DependencyProperty
///
public static readonly DependencyProperty ColumnHeaderTemplateProperty =
DependencyProperty.Register(
"ColumnHeaderTemplate",
typeof(DataTemplate),
typeof(GridView),
new FrameworkPropertyMetadata(
new PropertyChangedCallback(OnColumnHeaderTemplateChanged))
);
///
/// column header template
///
public DataTemplate ColumnHeaderTemplate
{
get { return (DataTemplate)GetValue(ColumnHeaderTemplateProperty); }
set { SetValue(ColumnHeaderTemplateProperty, value); }
}
private static void OnColumnHeaderTemplateChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
GridView dv = (GridView)d;
// Check to prevent Template and TemplateSelector at the same time
Helper.CheckTemplateAndTemplateSelector("GridViewColumnHeader", ColumnHeaderTemplateProperty, ColumnHeaderTemplateSelectorProperty, dv);
}
#endregion ColumnHeaderTemplate
#region ColumnHeaderTemplateSelector
///
/// ColumnHeaderTemplateSelector DependencyProperty
///
public static readonly DependencyProperty ColumnHeaderTemplateSelectorProperty =
DependencyProperty.Register(
"ColumnHeaderTemplateSelector",
typeof(DataTemplateSelector),
typeof(GridView),
new FrameworkPropertyMetadata(
new PropertyChangedCallback(OnColumnHeaderTemplateSelectorChanged))
);
///
/// header template selector
///
///
/// This property is ignored if is set.
///
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public DataTemplateSelector ColumnHeaderTemplateSelector
{
get { return (DataTemplateSelector)GetValue(ColumnHeaderTemplateSelectorProperty); }
set { SetValue(ColumnHeaderTemplateSelectorProperty, value); }
}
private static void OnColumnHeaderTemplateSelectorChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
GridView dv = (GridView)d;
// Check to prevent Template and TemplateSelector at the same time
Helper.CheckTemplateAndTemplateSelector("GridViewColumnHeader", ColumnHeaderTemplateProperty, ColumnHeaderTemplateSelectorProperty, dv);
}
#endregion ColumnHeaderTemplateSelector
#region ColumnHeaderStringFormat
///
/// ColumnHeaderStringFormat DependencyProperty
///
public static readonly DependencyProperty ColumnHeaderStringFormatProperty =
DependencyProperty.Register(
"ColumnHeaderStringFormat",
typeof(String),
typeof(GridView)
);
///
/// column header string format
///
public String ColumnHeaderStringFormat
{
get { return (String)GetValue(ColumnHeaderStringFormatProperty); }
set { SetValue(ColumnHeaderStringFormatProperty, value); }
}
#endregion ColumnHeaderStringFormat
#region AllowsColumnReorder
///
/// AllowsColumnReorderProperty DependencyProperty
///
public static readonly DependencyProperty AllowsColumnReorderProperty =
DependencyProperty.Register(
"AllowsColumnReorder",
typeof(bool),
typeof(GridView),
new FrameworkPropertyMetadata(BooleanBoxes.TrueBox /* default value */
)
);
///
/// AllowsColumnReorder
///
public bool AllowsColumnReorder
{
get { return (bool)GetValue(AllowsColumnReorderProperty); }
set { SetValue(AllowsColumnReorderProperty, value); }
}
#endregion AllowsColumnReorder
#region ColumnHeaderContextMenu
///
/// ColumnHeaderContextMenuProperty DependencyProperty
///
public static readonly DependencyProperty ColumnHeaderContextMenuProperty =
DependencyProperty.Register(
"ColumnHeaderContextMenu",
typeof(ContextMenu),
typeof(GridView)
);
///
/// ColumnHeaderContextMenu
///
public ContextMenu ColumnHeaderContextMenu
{
get { return (ContextMenu)GetValue(ColumnHeaderContextMenuProperty); }
set { SetValue(ColumnHeaderContextMenuProperty, value); }
}
#endregion ColumnHeaderContextMenu
#region ColumnHeaderToolTip
///
/// ColumnHeaderToolTipProperty DependencyProperty
///
public static readonly DependencyProperty ColumnHeaderToolTipProperty =
DependencyProperty.Register(
"ColumnHeaderToolTip",
typeof(object),
typeof(GridView)
);
///
/// ColumnHeaderToolTip
///
public object ColumnHeaderToolTip
{
get { return GetValue(ColumnHeaderToolTipProperty); }
set { SetValue(ColumnHeaderToolTipProperty, value); }
}
#endregion ColumnHeaderToolTip
#endregion // Public Properties
//-------------------------------------------------------------------
//
// Protected Methods
//
//-------------------------------------------------------------------
#region Protected Methods
///
/// called when ListView is prepare container for item.
/// GridView override this method to attache the column collection
///
/// the container
protected internal override void PrepareItem(ListViewItem item)
{
base.PrepareItem(item);
// attach GridViewColumnCollection to ListViewItem.
SetColumnCollection(item, _columns);
}
///
/// called when ListView is clear container for item.
/// GridView override this method to clear the column collection
///
/// the container
protected internal override void ClearItem(ListViewItem item)
{
item.ClearValue(ColumnCollectionProperty);
base.ClearItem(item);
}
#endregion
//-------------------------------------------------------------------
//
// Protected Properties
//
//--------------------------------------------------------------------
#region Protected Properties
///
/// override with style key of GridView.
///
protected internal override object DefaultStyleKey
{
get { return GridViewStyleKey; }
}
///
/// override with style key using GridViewRowPresenter.
///
protected internal override object ItemContainerDefaultStyleKey
{
get { return GridViewItemContainerStyleKey; }
}
#endregion
//-------------------------------------------------------------------
//
// Internal Methods
//
//--------------------------------------------------------------------
#region Internal Methods
internal override void OnInheritanceContextChangedCore(EventArgs args)
{
base.OnInheritanceContextChangedCore(args);
if (_columns != null)
{
foreach (GridViewColumn column in _columns)
{
column.OnInheritanceContextChanged(args);
}
}
}
// Propagate theme changes to contained headers
internal override void OnThemeChanged()
{
if (_columns != null)
{
for (int i=0; i<_columns.Count; i++)
{
_columns[i].OnThemeChanged();
}
}
}
#endregion
//--------------------------------------------------------------------
//
// Private Fields
//
//-------------------------------------------------------------------
#region Private Fields
private GridViewColumnCollection _columns;
#endregion // Private Fields
internal GridViewHeaderRowPresenter HeaderRowPresenter
{
get { return _gvheaderRP; }
set { _gvheaderRP = value; }
}
private GridViewHeaderRowPresenter _gvheaderRP;
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------------------
//
// Copyright (C) Microsoft Corporation. All rights reserved.
//
//---------------------------------------------------------------------------
using System.ComponentModel; // DesignerSerializationVisibility
using System.Windows.Automation.Peers;
using System.Windows.Markup;
using System.Diagnostics; // Debug
using MS.Internal; // Helper
using MS.Internal.KnownBoxes;
namespace System.Windows.Controls
{
///
/// GridView is a built-in view of the ListView control. It is unique
/// from other built-in views because of its table-like layout. Data in
/// details view is shown in a table with each row corresponding to an
/// entity in the data collection and each column being generated from a
/// data-bound template, populated with values from the bound data entity.
///
[StyleTypedProperty(Property = "ColumnHeaderContainerStyle", StyleTargetType = typeof(System.Windows.Controls.GridViewColumnHeader))]
[ContentProperty("Columns")]
public class GridView : ViewBase, IAddChild
{
//-------------------------------------------------------------------
//
// Constructors
//
//-------------------------------------------------------------------
//--------------------------------------------------------------------
//
// Public Methods
//
//-------------------------------------------------------------------
#region Public Methods
///
/// Add an object child to this control
///
void IAddChild.AddChild(object column)
{
AddChild(column);
}
///
/// Add an object child to this control
///
protected virtual void AddChild(object column)
{
GridViewColumn c = column as GridViewColumn;
if (c != null)
{
Columns.Add(c);
}
else
{
throw new InvalidOperationException(SR.Get(SRID.ListView_IllegalChildrenType));
}
}
///
/// Add a text string to this control
///
void IAddChild.AddText(string text)
{
AddText(text);
}
///
/// Add a text string to this control
///
protected virtual void AddText(string text)
{
AddChild(text);
}
///
/// Returns a string representation of this object.
///
///
public override string ToString()
{
return SR.Get(SRID.ToStringFormatString_GridView, this.GetType(), Columns.Count);
}
///
/// called when ListView creates its Automation peer
/// GridView override this method to return a GridViewAutomationPeer
///
/// listview reference
/// GridView automation peer
internal protected override IViewAutomationPeer GetAutomationPeer(ListView parent)
{
return new GridViewAutomationPeer(this, parent);
}
#endregion
//--------------------------------------------------------------------
//
// Public Properties
//
//--------------------------------------------------------------------
#region Public Properties
// For all the DPs on GridView, null is treated as unset,
// because it's impossible to distinguish null and unset.
// Change a property between null and unset, PropertyChangedCallback will not be called.
// ---------------------------------------------------------------------------
// Defines the names of the resources to be consumed by the GridView style.
// Used to restyle several roles of GridView without having to restyle
// all of the control.
// ----------------------------------------------------------------------------
#region StyleKeys
///
/// Key used to mark the template of ScrollViewer for use by GridView
///
public static ResourceKey GridViewScrollViewerStyleKey
{
get
{
if (_scrollViewerStyleKey == null)
{
_scrollViewerStyleKey = new SystemThemeKey(SystemResourceKeyID.GridViewScrollViewerStyle);
}
return _scrollViewerStyleKey;
}
}
private static SystemThemeKey _scrollViewerStyleKey;
///
/// Key used to mark the Style of GridView
///
public static ResourceKey GridViewStyleKey
{
get
{
if (_gridViewStyleKey == null)
{
_gridViewStyleKey = new SystemThemeKey(SystemResourceKeyID.GridViewStyle);
}
return _gridViewStyleKey;
}
}
private static SystemThemeKey _gridViewStyleKey;
///
/// Key used to mark the Style of ItemContainer
///
public static ResourceKey GridViewItemContainerStyleKey
{
get
{
if (_gridViewItemContainerStyleKey == null)
{
_gridViewItemContainerStyleKey = new SystemThemeKey(SystemResourceKeyID.GridViewItemContainerStyle);
}
return _gridViewItemContainerStyleKey;
}
}
private static SystemThemeKey _gridViewItemContainerStyleKey;
#endregion StyleKeys
#region GridViewColumnCollection Attached DP
///
/// Reads the attached property GridViewColumnCollection from the given element.
///
/// The element from which to read the GridViewColumnCollection attached property.
/// The property's value.
public static GridViewColumnCollection GetColumnCollection(DependencyObject element)
{
if (element == null) { throw new ArgumentNullException("element"); }
return (GridViewColumnCollection)element.GetValue(ColumnCollectionProperty);
}
///
/// Writes the attached property GridViewColumnCollection to the given element.
///
/// The element to which to write the GridViewColumnCollection attached property.
/// The collection to set
public static void SetColumnCollection(DependencyObject element, GridViewColumnCollection collection)
{
if (element == null) { throw new ArgumentNullException("element"); }
element.SetValue(ColumnCollectionProperty, collection);
}
///
/// This is the dependency property registered for the GridView' ColumnCollection attached property.
///
public static readonly DependencyProperty ColumnCollectionProperty
= DependencyProperty.RegisterAttached(
"ColumnCollection",
typeof(GridViewColumnCollection),
typeof(GridView));
///
/// Whether should serialize ColumnCollection attach DP
///
/// Object on which this DP is set
[EditorBrowsable(EditorBrowsableState.Never)]
public static bool ShouldSerializeColumnCollection(DependencyObject obj)
{
ListViewItem listViewItem = obj as ListViewItem;
if (listViewItem != null)
{
ListView listView = listViewItem.ParentSelector as ListView;
if (listView != null)
{
GridView gridView = listView.View as GridView;
if (gridView != null)
{
// if GridViewColumnCollection attached on ListViewItem is Details.Columns, it should't be serialized.
GridViewColumnCollection localValue = listViewItem.ReadLocalValue(ColumnCollectionProperty) as GridViewColumnCollection;
return (localValue != gridView.Columns);
}
}
}
return true;
}
#endregion
/// GridViewColumn List
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
public GridViewColumnCollection Columns
{
get
{
if (_columns == null)
{
_columns = new GridViewColumnCollection();
// Give the collection a back-link, this is used for the inheritance context
_columns.Owner = this;
_columns.InViewMode = true;
}
return _columns;
}
}
#region ColumnHeaderContainerStyle
///
/// ColumnHeaderContainerStyleProperty DependencyProperty
///
public static readonly DependencyProperty ColumnHeaderContainerStyleProperty =
DependencyProperty.Register(
"ColumnHeaderContainerStyle",
typeof(Style),
typeof(GridView)
);
///
/// header container's style
///
public Style ColumnHeaderContainerStyle
{
get { return (Style)GetValue(ColumnHeaderContainerStyleProperty); }
set { SetValue(ColumnHeaderContainerStyleProperty, value); }
}
#endregion // ColumnHeaderContainerStyle
#region ColumnHeaderTemplate
///
/// ColumnHeaderTemplate DependencyProperty
///
public static readonly DependencyProperty ColumnHeaderTemplateProperty =
DependencyProperty.Register(
"ColumnHeaderTemplate",
typeof(DataTemplate),
typeof(GridView),
new FrameworkPropertyMetadata(
new PropertyChangedCallback(OnColumnHeaderTemplateChanged))
);
///
/// column header template
///
public DataTemplate ColumnHeaderTemplate
{
get { return (DataTemplate)GetValue(ColumnHeaderTemplateProperty); }
set { SetValue(ColumnHeaderTemplateProperty, value); }
}
private static void OnColumnHeaderTemplateChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
GridView dv = (GridView)d;
// Check to prevent Template and TemplateSelector at the same time
Helper.CheckTemplateAndTemplateSelector("GridViewColumnHeader", ColumnHeaderTemplateProperty, ColumnHeaderTemplateSelectorProperty, dv);
}
#endregion ColumnHeaderTemplate
#region ColumnHeaderTemplateSelector
///
/// ColumnHeaderTemplateSelector DependencyProperty
///
public static readonly DependencyProperty ColumnHeaderTemplateSelectorProperty =
DependencyProperty.Register(
"ColumnHeaderTemplateSelector",
typeof(DataTemplateSelector),
typeof(GridView),
new FrameworkPropertyMetadata(
new PropertyChangedCallback(OnColumnHeaderTemplateSelectorChanged))
);
///
/// header template selector
///
///
/// This property is ignored if is set.
///
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public DataTemplateSelector ColumnHeaderTemplateSelector
{
get { return (DataTemplateSelector)GetValue(ColumnHeaderTemplateSelectorProperty); }
set { SetValue(ColumnHeaderTemplateSelectorProperty, value); }
}
private static void OnColumnHeaderTemplateSelectorChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
GridView dv = (GridView)d;
// Check to prevent Template and TemplateSelector at the same time
Helper.CheckTemplateAndTemplateSelector("GridViewColumnHeader", ColumnHeaderTemplateProperty, ColumnHeaderTemplateSelectorProperty, dv);
}
#endregion ColumnHeaderTemplateSelector
#region ColumnHeaderStringFormat
///
/// ColumnHeaderStringFormat DependencyProperty
///
public static readonly DependencyProperty ColumnHeaderStringFormatProperty =
DependencyProperty.Register(
"ColumnHeaderStringFormat",
typeof(String),
typeof(GridView)
);
///
/// column header string format
///
public String ColumnHeaderStringFormat
{
get { return (String)GetValue(ColumnHeaderStringFormatProperty); }
set { SetValue(ColumnHeaderStringFormatProperty, value); }
}
#endregion ColumnHeaderStringFormat
#region AllowsColumnReorder
///
/// AllowsColumnReorderProperty DependencyProperty
///
public static readonly DependencyProperty AllowsColumnReorderProperty =
DependencyProperty.Register(
"AllowsColumnReorder",
typeof(bool),
typeof(GridView),
new FrameworkPropertyMetadata(BooleanBoxes.TrueBox /* default value */
)
);
///
/// AllowsColumnReorder
///
public bool AllowsColumnReorder
{
get { return (bool)GetValue(AllowsColumnReorderProperty); }
set { SetValue(AllowsColumnReorderProperty, value); }
}
#endregion AllowsColumnReorder
#region ColumnHeaderContextMenu
///
/// ColumnHeaderContextMenuProperty DependencyProperty
///
public static readonly DependencyProperty ColumnHeaderContextMenuProperty =
DependencyProperty.Register(
"ColumnHeaderContextMenu",
typeof(ContextMenu),
typeof(GridView)
);
///
/// ColumnHeaderContextMenu
///
public ContextMenu ColumnHeaderContextMenu
{
get { return (ContextMenu)GetValue(ColumnHeaderContextMenuProperty); }
set { SetValue(ColumnHeaderContextMenuProperty, value); }
}
#endregion ColumnHeaderContextMenu
#region ColumnHeaderToolTip
///
/// ColumnHeaderToolTipProperty DependencyProperty
///
public static readonly DependencyProperty ColumnHeaderToolTipProperty =
DependencyProperty.Register(
"ColumnHeaderToolTip",
typeof(object),
typeof(GridView)
);
///
/// ColumnHeaderToolTip
///
public object ColumnHeaderToolTip
{
get { return GetValue(ColumnHeaderToolTipProperty); }
set { SetValue(ColumnHeaderToolTipProperty, value); }
}
#endregion ColumnHeaderToolTip
#endregion // Public Properties
//-------------------------------------------------------------------
//
// Protected Methods
//
//-------------------------------------------------------------------
#region Protected Methods
///
/// called when ListView is prepare container for item.
/// GridView override this method to attache the column collection
///
/// the container
protected internal override void PrepareItem(ListViewItem item)
{
base.PrepareItem(item);
// attach GridViewColumnCollection to ListViewItem.
SetColumnCollection(item, _columns);
}
///
/// called when ListView is clear container for item.
/// GridView override this method to clear the column collection
///
/// the container
protected internal override void ClearItem(ListViewItem item)
{
item.ClearValue(ColumnCollectionProperty);
base.ClearItem(item);
}
#endregion
//-------------------------------------------------------------------
//
// Protected Properties
//
//--------------------------------------------------------------------
#region Protected Properties
///
/// override with style key of GridView.
///
protected internal override object DefaultStyleKey
{
get { return GridViewStyleKey; }
}
///
/// override with style key using GridViewRowPresenter.
///
protected internal override object ItemContainerDefaultStyleKey
{
get { return GridViewItemContainerStyleKey; }
}
#endregion
//-------------------------------------------------------------------
//
// Internal Methods
//
//--------------------------------------------------------------------
#region Internal Methods
internal override void OnInheritanceContextChangedCore(EventArgs args)
{
base.OnInheritanceContextChangedCore(args);
if (_columns != null)
{
foreach (GridViewColumn column in _columns)
{
column.OnInheritanceContextChanged(args);
}
}
}
// Propagate theme changes to contained headers
internal override void OnThemeChanged()
{
if (_columns != null)
{
for (int i=0; i<_columns.Count; i++)
{
_columns[i].OnThemeChanged();
}
}
}
#endregion
//--------------------------------------------------------------------
//
// Private Fields
//
//-------------------------------------------------------------------
#region Private Fields
private GridViewColumnCollection _columns;
#endregion // Private Fields
internal GridViewHeaderRowPresenter HeaderRowPresenter
{
get { return _gvheaderRP; }
set { _gvheaderRP = value; }
}
private GridViewHeaderRowPresenter _gvheaderRP;
}
}
// 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
- ControlAdapter.cs
- EdmProperty.cs
- ValueType.cs
- GradientStopCollection.cs
- PromptBuilder.cs
- XmlChildEnumerator.cs
- dbenumerator.cs
- StreamHelper.cs
- Transform3DGroup.cs
- NativeMethods.cs
- WebConfigurationFileMap.cs
- panel.cs
- AppDomainGrammarProxy.cs
- XmlSchemaSequence.cs
- PersonalizationStateQuery.cs
- XmlNode.cs
- ChannelManager.cs
- AnimationStorage.cs
- ToolBarButtonClickEvent.cs
- DataObject.cs
- OrderedDictionary.cs
- CodeDomConfigurationHandler.cs
- FunctionImportMapping.cs
- SystemPens.cs
- COM2TypeInfoProcessor.cs
- SetterBase.cs
- Stacktrace.cs
- WmlValidationSummaryAdapter.cs
- ImportCatalogPart.cs
- ToolStripPanelRenderEventArgs.cs
- AppManager.cs
- SharingService.cs
- HtmlShim.cs
- CLSCompliantAttribute.cs
- XmlSchemaAny.cs
- CssTextWriter.cs
- SqlNodeAnnotation.cs
- Expressions.cs
- XamlReaderHelper.cs
- IsolatedStoragePermission.cs
- CredentialManagerDialog.cs
- TreeNode.cs
- securitycriticaldata.cs
- AnnotationAdorner.cs
- SymLanguageVendor.cs
- StringReader.cs
- RadioButtonFlatAdapter.cs
- TextChange.cs
- _BaseOverlappedAsyncResult.cs
- ReceiveCompletedEventArgs.cs
- OletxTransactionHeader.cs
- DBCommand.cs
- Style.cs
- Parameter.cs
- Stroke2.cs
- XamlFilter.cs
- InstalledVoice.cs
- BinHexEncoder.cs
- RSAProtectedConfigurationProvider.cs
- ToolboxItemFilterAttribute.cs
- WebPartConnectionsCancelVerb.cs
- SystemIPAddressInformation.cs
- TextServicesPropertyRanges.cs
- NamespaceCollection.cs
- SyndicationFeedFormatter.cs
- DataException.cs
- DynamicValidatorEventArgs.cs
- Point3DCollectionValueSerializer.cs
- ImageIndexConverter.cs
- XmlBoundElement.cs
- _NativeSSPI.cs
- _ProxyChain.cs
- ResizeGrip.cs
- HTTPAPI_VERSION.cs
- VariableQuery.cs
- EntitySqlQueryCacheKey.cs
- SecurityAlgorithmSuiteConverter.cs
- EventLogTraceListener.cs
- XXXInfos.cs
- TransformConverter.cs
- ParserHooks.cs
- XpsFixedDocumentReaderWriter.cs
- Reference.cs
- SuppressMessageAttribute.cs
- DbParameterCollection.cs
- ConnectionStringsSection.cs
- WrappedIUnknown.cs
- WebBrowserUriTypeConverter.cs
- xsdvalidator.cs
- HMACSHA1.cs
- HttpHeaderCollection.cs
- SqlServer2KCompatibilityAnnotation.cs
- TextPenaltyModule.cs
- DateTimeSerializationSection.cs
- FileLevelControlBuilderAttribute.cs
- InternalConfirm.cs
- CommandLibraryHelper.cs
- InspectionWorker.cs
- Vector3D.cs
- SqlAliasesReferenced.cs