GridView Class
Represents a view mode that displays data items in columns for a ListView control.
XAML<Grid>
<ListView Margin="10">
<ListView.View>
<GridView>
<GridViewColumn Header="Name" Width="120" DisplayMemberBinding="{Binding Name}"/>
<GridViewColumn Header="Age" Width="50" DisplayMemberBinding="{Binding Age}"/>
<GridViewColumn Header="Mail" Width="150" DisplayMemberBinding="{Binding Mail}"/>
</GridView>
</ListView.View>
</ListView>
</Grid>
The GridView class and its supporting classes provide the infrastructure to display data items that are specified for a ListView control in a series of columns. The columns have column headers, which are buttons that are derived from ButtonBase, and you can reorder the columns by using drag-and-drop operations. Note that the columns of a GridView display data and do not provide direct access to the source of the data.
The columns in a GridView are defined as GridViewColumn objects. In XAML, you can define GridViewColumn objects as child elements of the GridView.
Properties
Name |
Description |
AllowsColumnReorder |
Gets or sets whether columns in a GridView can be reordered by a drag-and-drop operation |
ColumnHeaderContainerStyle |
Gets or sets the style to apply to column headers |
ColumnHeaderContextMenu |
Gets or sets a ContextMenu for the GridView |
ColumnHeaderStringFormat |
Gets or sets a composite string that specifies how to format the column headers of the GridView if they are displayed as strings |
ColumnHeaderTemplate |
Gets or sets a template to use to display the column headers |
ColumnHeaderTemplateSelector |
Gets or sets the selector object that provides logic for selecting a template to use for each column header |
ColumnHeaderToolTip |
Gets or sets the content of a tooltip that appears when the mouse pointer pauses over one of the column headers |
Columns |
Gets the collection of GridViewColumn objects that is defined for this GridView |
Dependency Property Reflection Property
Name |
Description |
CanFreeze |
Gets a value that indicates whether the object can be made unmodifiable. |
IsFrozen |
Gets a value that indicates whether the object is currently modifiable. |
Dependency Property Reflection Property
Name |
Description |
ThreadId |
Gets the thread this DispatcherObject is associated with. Returns NoThreadId when this object is not attached to any thread. |
Dependency Property Reflection Property
Attached Properties
Name |
Description |
ColumnCollection |
Gets or sets the attached property that contains the GridViewColumnCollection |
Methods
Name |
Description |
ClearItem(item) |
Removes all bindings and styling that are set for an item |
PrepareItem(item) |
Prepares an item in the view for display, by setting bindings and styles |
Name |
Description |
Clone() |
Creates a modifiable clone of the Freezable, making deep copies of the object's values. When copying the object's dependency properties, this method copies expressions (which might no longer resolve) but not animations or their current values. The cloned Freezable::IsFrozen property is false even if the source's IsFrozen property is true. |
CloneCurrentValue() |
Creates a modifiable clone (deep copy) of the Freezable using its current values. The cloned object's IsFrozen property is false even if the source's IsFrozen property is true. |
Freeze() |
Makes the current object unmodifiable and sets its IsFrozen property to true. |
GetAsFrozen() |
Creates a frozen copy of the Freezable, using base (non-animated) property values. Because the copy is frozen, any frozen sub-objects are copied by reference. The copy's IsFrozen property is set to true. Throws if the Freezable cannot be frozen because it contains expressions or animated properties. |
GetCurrentValueAsFrozen() |
Creates a frozen copy of the Freezable using current property values. Because the copy is frozen, any frozen sub-objects are copied by reference. The copy's IsFrozen property is set to true. |
Name |
Description |
ClearAnimation(dp) |
Clears the animation value of a property |
ClearLocalValue(dp) |
Clears the local value of a property The property to be cleared is specified by a DependencyProperty identifier |
CoerceValue(dp) |
Coerces and validates the effective property value |
DependencyPropertyChanged() |
Returns the PropertyChanged event |
Destroyed() |
Destroyed delegate is raised when object is going to be destroyed |
GetBaseValue(dp) |
Returns the base value without animation nor coerce (this never returns Expression like GetLocalValue) |
GetExpression(dp) |
Gets the expression, if any, used to evaluate the specified property value |
GetLocalValue(dp) |
Returns the local value of a dependency property, if it exists |
GetValue(dp) |
Returns the current effective value of a dependency property on this instance of a DependencyObject |
GetValueObject(dp) |
Returns the current effective value of a dependency property on this instance of a DependencyObject as a boxed value |
GetValueProvider(dp) |
Gets the provider that returns the effective value for the specified dependency property |
HasAnimatedProperties() |
Returns true if there is any animated property |
InvalidateProperty(dp, priority) |
Re-evaluates the effective value for the specified dependency property if necessary If null is passed, a full re-evaluation could be needed |
IsCached(dp, provider) |
Returns if the value is stored in the cache. If true, the priority is returned in the provider field |
IsSealed() |
Gets a value that indicates whether this instance is currently sealed (read-only) |
SetAnimation(dp, value) |
Sets the animated value of a property |
SetCurrentValue(dp, value) |
Sets the current value of a dependency property. The current value is set on the coerce field, without modifying source or animated value |
SetCurrentValueObject(dp, value) |
Sets the current value of a dependency property using a boxed value |
SetExpression(dp, expression) |
Sets the expression to be evaluated dynamically to obtain the value of the property |
SetValue(dp, value) |
Sets the local value of a dependency property |
SetValueObject(dp, value) |
Sets the local value (boxed) of a dependency property |
Name |
Description |
CheckAccess() |
Determines whether the calling thread has access to this DispatcherObject |
VerifyAccess() |
Enforces that the calling thread has access to this DispatcherObject |
Events
GridView has no events