GridViewTemplate
This component represents a customizable view template for displaying flat tabular data.
Definition
Namespace:Telerik.WinControls.UI
Assembly:Telerik.WinControls.GridView.dll
Syntax:
public class GridViewTemplate : Component, IComponent, IDisposable, IDataItemSource, IHierarchicalRow, INotifyPropertyChangingEx, INotifyPropertyChanged, ISupportInitializeNotification, ISupportInitialize, IGridViewEventListener
Inheritance: objectMarshalByRefObjectComponentGridViewTemplate
Derived Classes:
Implements:
Inherited Members
Constructors
Initializes a new instance of the GridViewTemplate class.
public GridViewTemplate()
Properties
Gets or sets a value indicating the location of the new row in the view template.
[Browsable(true)]
public SystemRowPosition AddNewRowPosition { get; set; }
Gets or sets a value indicating whether the user can add new rows through the grid.
[Browsable(true)]
public bool AllowAddNewRow { get; set; }
When set to true an empty row is added in which the user can enter data for the new record.
Set to false to hide the row.
The row position is controlled through AddNewRowPosition
Gets or sets a value indicating whether user can automatically resize a column to fit its content by double-clicking the right border of header cell.
[Browsable(false)]
public bool AllowAutoSizeColumns { get; set; }
Gets or sets a value indicating whether context menu is displayed when user right clicks on a data cell.
[Browsable(true)]
public bool AllowCellContextMenu { get; set; }
Gets or sets a value indicating whether GridViewColumnChooser is available to the user for this instance of GridViewTemplate.
[Browsable(true)]
public bool AllowColumnChooser { get; set; }
Gets or sets a value indicating whether context menu is displayed when user right-clicks on a column header.
[Browsable(true)]
public bool AllowColumnHeaderContextMenu { get; set; }
Gets or sets a value indicating whether user can reorder Columns.
[Browsable(true)]
public bool AllowColumnReorder { get; set; }
Gets or sets a value indicating whether user can resize columns.
[Browsable(true)]
public bool AllowColumnResize { get; set; }
This property does not prevent developer from setting Width
Gets or sets a value indicating whether user can delete rows.
[Browsable(true)]
public bool AllowDeleteRow { get; set; }
Gets or sets a value indicating whether user can drag a column header to grouping panel.
[Browsable(true)]
public bool AllowDragToGroup { get; set; }
Gets or sets a value indicating whether user can edit rows.
[Browsable(true)]
public bool AllowEditRow { get; set; }
Gets or sets a value indicating whether the end-user can sort by more than one column.
[Browsable(true)]
public bool AllowMultiColumnSorting { get; set; }
Gets or sets a value indicating whether context menu is displayed when user right clicks on a row header.
[Browsable(true)]
public bool AllowRowHeaderContextMenu { get; set; }
Gets or sets a value indicating whether the user is able to reorder rows in the grid
[Browsable(true)]
public bool AllowRowReorder { get; set; }
Gets or sets a value indicating whether user can resize a row.
[Browsable(true)]
public bool AllowRowResize { get; set; }
This property does not prevent developer from setting Height
Gets or sets a value indicating whether the user can search in the data contained in the grid.
[Browsable(true)]
public bool AllowSearchRow { get; set; }
When set to true a search row is added where the user can enter search criteria. Set to false to hide the row. The row position is controlled through SearchRowPosition
Sets or gets a value indicating the initial state of group rows when data is grouped.
[Browsable(true)]
public bool AutoExpandGroups { get; set; }
Gets or sets a value indicating whether columns are created automatically when the or properties are set.
[Browsable(true)]
public bool AutoGenerateColumns { get; set; }
Returns true if the columns should be created automatically; otherwise, false. The default is true.
Gets or sets a value indicating how column widths are determined.
[Browsable(true)]
public GridViewAutoSizeColumnsMode AutoSizeColumnsMode { get; set; }
Gets or sets a value indicating whether the underlying source in Object-relational binding should be automatically updated on create,update or delete operations (enables CRUD in Object-relational mode).
[Browsable(true)]
public bool AutoUpdateObjectRelationalSource { get; set; }
Gets or sets the binding context for data binding operations.
[Browsable(false)]
public BindingContext BindingContext { get; }
The BindingContext used for data binding.
Implements:
Gets or sets a value indicating how bottom pinned rows are laid out.
[Browsable(true)]
public GridViewBottomPinnedRowsMode BottomPinnedRowsMode { get; set; }
Gets or sets the caption text.
[Browsable(true)]
public string Caption { get; set; }
Indicates whether string comparisons of data are case-sensitive.
[Browsable(true)]
public bool CaseSensitive { get; set; }
Gets the collection of child rows for this grid view template.
[Browsable(false)]
public GridViewChildRowCollection ChildRows { get; }
A GridViewChildRowCollection containing the child rows.
Implements:
Gets or sets the position to place tabs for child views related with this template.
[Browsable(true)]
public TabPositions ChildViewTabsPosition { get; set; }
Gets or sets the number of columns displayed in the current GridViewTemplate.
[Browsable(false)]
public int ColumnCount { get; set; }
Gets the collection of columns in this grid view template.
public virtual GridViewColumnCollection Columns { get; }
A GridViewColumnCollection containing the columns.
Gets a value indicating if the template contains a column with defined expression.
[Browsable(false)]
public bool ContainsColumnExpression { get; }
Gets or sets the column containing the current cell in the grid.
[Browsable(false)]
public GridViewColumn CurrentColumn { get; set; }
Gets or sets the name of the list or table in the data source for which the GridViewTemplate is displaying data.
[Browsable(true)]
public string DataMember { get; set; }
Gets or sets the data source that the GridViewTemplate is displaying data for.
public object DataSource { get; set; }
Gets the data view.
[Browsable(false)]
public RadCollectionView<GridViewRowInfo> DataView { get; }
The data view.
Gets or sets a value indicating whether alternating row color is enabled.
[Browsable(true)]
public virtual bool EnableAlternatingRowColor { get; set; }
Gets or sets a value indicating whether the data can be filtered programmatically.
[Browsable(true)]
public bool EnableCustomFiltering { get; set; }
Gets or sets a value indicating whether the data can be grouped programmatically.
[Browsable(true)]
public bool EnableCustomGrouping { get; set; }
Gets or sets a value indicating whether the data can be sorted programmatically.
[Browsable(true)]
public bool EnableCustomSorting { get; set; }
Gets or sets a value indicating whether the data in the current DataView can be filtered.
[Browsable(true)]
public bool EnableFiltering { get; set; }
Gets or sets a value indicating whether the data in the current GridViewTemplate can be grouped by users.
public bool EnableGrouping { get; set; }
Gets or sets a value indicating whether the data can be filtered using parent/child relationship.
[Browsable(false)]
public bool EnableHierarchyFiltering { get; set; }
Gets or sets a value indicating whether the data can be sorted by the end-users.
[Browsable(true)]
public bool EnableSorting { get; set; }
Gets the event dispatcher
[Browsable(false)]
public virtual EventDispatcher EventDispatcher { get; }
Gets the filter descriptors.
[Browsable(true)]
public FilterDescriptorCollection FilterDescriptors { get; }
The filter descriptors.
Gets or sets the filter predicate used for filtering operation.
[Browsable(false)]
public Predicate<GridViewRowInfo> FilterPredicate { get; set; }
The filter.
GroupComparer
IComparer<Group<GridViewRowInfo>>
Gets or sets the group comparer.
[Browsable(false)]
public IComparer<Group<GridViewRowInfo>> GroupComparer { get; set; }
The group comparer.
Gets the group descriptors.
[Browsable(true)]
public GroupDescriptorCollection GroupDescriptors { get; }
The group descriptors.
Gets or sets the group predicate.
[Browsable(false)]
public GroupPredicate<GridViewRowInfo> GroupPredicate { get; set; }
The group predicate.
Gets the groups.
[Browsable(false)]
public DataGroupCollection Groups { get; }
The groups.
Gets or sets the hierarchy data provider.
[Browsable(false)]
public virtual GridViewHierarchyDataProvider HierarchyDataProvider { get; set; }
The hierarchy data provider.
Gets the level of nesting for this template.
[Browsable(false)]
public int HierarchyLevel { get; }
Implements:
Gets or sets the display state of grid horizontal scrollbars.
[Browsable(true)]
public ScrollState HorizontalScrollState { get; set; }
Gets a value indicating whether the component is initialized.
[Browsable(false)]
public bool IsInitialized { get; }
Implements:
Gets a value indicating whether this is self reference relation.
[Browsable(false)]
public bool IsSelfReference { get; }
true if this relation is self reference; otherwise, false.
Determines whether the template is in a Begin/End update block.
[Browsable(false)]
public bool IsUpdating { get; }
Gets a value indicating whether the ChildRows in hierarchy mode is virtual and hosted outside Rows collection.
[Browsable(false)]
public bool IsVirtualRows { get; }
true if this instance is virtual rows; otherwise, false.
Gets the list source.
[Browsable(false)]
public RadListSource<GridViewRowInfo> ListSource { get; }
The list source.
Gets the root template.
[Browsable(false)]
public virtual MasterGridViewTemplate MasterTemplate { get; }
Gets the master view info.
[Browsable(false)]
public GridViewInfo MasterViewInfo { get; }
The master view info.
Sets a value indicating how the merged cells will be edited.
[Browsable(true)]
public MergeCellsEditMode MergeCellsEditMode { get; set; }
Indicates whether and how the cells will be merged.
[Browsable(true)]
public MergeCellsMode MergeCellsMode { get; set; }
Gets or sets the text displayed in the new row. If this values is null or empty the text from the localization provider will be used.
[Browsable(true)]
public string NewRowText { get; set; }
The new row text.
Gets or sets the parent.
[Browsable(false)]
public GridViewTemplate Parent { get; }
The parent.
Gets a readonly collection of GridViewColumn containing the pinned rows in this template.
[Browsable(false)]
public ReadOnlyCollection<GridViewColumn> PinnedColumns { get; }
Gets or sets a value indicating whether the data in this template can be modified
[Browsable(true)]
public bool ReadOnly { get; set; }
Gets or sets the number of rows contained in the current GridViewTemplate.
[Browsable(false)]
public int RowCount { get; set; }
Gets the collection of rows in this grid view template.
[Browsable(false)]
public GridViewRowCollection Rows { get; }
A GridViewRowCollection containing the rows.
Gets or sets a value indicating the location of the search row in the view template.
[Browsable(true)]
public SystemRowPosition SearchRowPosition { get; set; }
Gets or sets a value indicating whether the last added row in the RadGridView DataSource will be selected by the control.
public bool SelectLastAddedRow { get; set; }
true if [select last added row]; otherwise, false.
This property controls if the new row will be made current if there are no other row in the grid.
public bool SelectNewRowAsCurrent { get; set; }
Gets or sets a value indicating whether to show child view captions.
[Browsable(true)]
public bool ShowChildViewCaptions { get; set; }
Indicates whether summary rows of collapsed groups will be visible. If true the summary rows will not be hidden when the group is collapsed. Note that the GridViewGroupRowInfo has the same property and it has higher priority. If you need different behavior for different groups/group levels, you can use the CreateRowInfo event and set the ShowCollapsedGroupSummaries of each group individually.
[Browsable(true)]
public bool ShowCollapsedGroupSummaries { get; set; }
Gets or sets a value indicating whether the column headers are visible.
[Browsable(true)]
public bool ShowColumnHeaders { get; set; }
Gets or sets a value indicating whether the filter operator text should be shown in the filter cell
[Browsable(true)]
public bool ShowFilterCellOperatorText { get; set; }
true if [show filter cell operator text]; otherwise, false.
Gets or sets a value indicating whether the filtering row should be visible.
[Browsable(true)]
public bool ShowFilteringRow { get; set; }
Gets or sets a value indicating whether the columns by which the data is grouped are visible.
[Browsable(true)]
public bool ShowGroupedColumns { get; set; }
Set to false, and each column contained in the GroupDescriptors, will get hidden. Set to true to see all columns. If some column is still not visible, check IsVisible.
Gets or sets a value indicating whether the header cell buttons are visible.
[Browsable(true)]
public bool ShowHeaderCellButtons { get; set; }
Gets or sets a value indicating whether parent group summary rows are visible in grouping.
[Browsable(true)]
public bool ShowParentGroupSummaries { get; set; }
Gets or sets a value indicating whether the row header column is visible.
[Browsable(true)]
public bool ShowRowHeaderColumn { get; set; }
Gets or sets a value indicating whether the select column is visible. The select column in only supported for the GridViewSelectionMode.FullRowSelect.
[Browsable(true)]
public bool ShowSelectColumn { get; set; }
Gets or sets a value indicating whether summary rows will be shown for each group. The property is only relevant when the grid is grouped.
[Browsable(true)]
public bool ShowSubTotals { get; set; }
Gets or sets a value indicating whether total summary rows are visible in grouping.
[Browsable(true)]
public bool ShowTotals { get; set; }
SortComparer
IComparer<GridViewRowInfo>
Gets or sets the sort comparer.
[Browsable(false)]
public IComparer<GridViewRowInfo> SortComparer { get; set; }
The sort comparer.
Gets the sort descriptors.
[Browsable(true)]
public SortDescriptorCollection SortDescriptors { get; }
The sort descriptors.
Gets the collection containing the summary items placed in the group header.
[Browsable(false)]
public GridViewSummaryRowItemCollection SummaryRowGroupHeaders { get; }
Gets the collection containing summary rows placed at the bottom of each DataGroup.
[Browsable(true)]
public GridViewSummaryRowItemCollection SummaryRowsBottom { get; }
Gets the collection containing summary rows placed on top of each DataGroup.
[Browsable(true)]
public GridViewSummaryRowItemCollection SummaryRowsTop { get; }
Gets or sets the tag.
[Bindable(true)]
[TypeConverter(typeof(StringConverter))]
public object Tag { get; set; }
The tag.
Gets the collection of child grid view templates.
[Browsable(true)]
public GridViewTemplateCollection Templates { get; }
A GridViewTemplateCollection containing the child templates.
Gets or sets a value indicating whether users can select rows only via the selection checkboxes.
[Browsable(true)]
public bool UseCheckboxRowSelectionOnly { get; set; }
true if checkbox-only row selection is enabled; otherwise, false.
This property will only be considered if ShowSelectColumn is true.
Gets or sets the display state of grid vertical scrollbars.
[Browsable(true)]
public ScrollState VerticalScrollState { get; set; }
Gets or sets the IGridViewDefinition associated with this template.
[Browsable(false)]
public IGridViewDefinition ViewDefinition { get; set; }
Methods
Analyzes a queue of grid view events.
protected virtual bool AnalyzeQueueCore(List<GridViewEvent> events)
The list of events to analyze.
Returns:true if the queue was analyzed successfully; otherwise, false.
Begins initialization of the view template.
public virtual void BeginInit()
Implements:
Begins an update block to defer notifications and improve performance during bulk operations.
public virtual void BeginUpdate()
Automatically adjusts the width of all columns to fit their content.
public void BestFitColumns()
Automatically adjusts the width of all columns to fit their content using the specified mode.
public void BestFitColumns(BestFitColumnMode mode)
The best fit mode to use for column sizing.
Clears all summaries from groups.
protected virtual void ClearAllSummariesFromGroups()
Collapses all expandable rows.
public void CollapseAll()
Collapses all group rows when data is grouped.
public void CollapseAllGroups()
Creates the binding context for this grid view template.
protected virtual BindingContext CreateBindingContext()
A new instance of BindingContext.
Creates the list source for this grid view template.
protected virtual GridViewListSource CreateListSource()
A new instance of GridViewListSource.
Defers refresh operations until the returned IDisposable is disposed.
public virtual IDisposable DeferRefresh()
An IDisposable that ends the defer refresh when disposed.
Dispatches the event.
protected virtual void DispatchEvent(GridViewEvent gridEvent, bool postUI)
The grid event.
postUIboolThe post UI.
Dispatches the event.
protected virtual void DispatchEvent(GridViewEvent gridEvent)
The grid event.
Ends view template initialization.
public virtual void EndInit()
Implements:
Ends the update block and triggers notifications.
public void EndUpdate()
Ends the update block with control over notifications and specific event arguments.
public virtual void EndUpdate(bool notify, DataViewChangedEventArgs e)
If set to true, triggers change notifications.
The event arguments describing the view changes.
Ends the update block with the option to control notifications.
public void EndUpdate(bool notify)
If set to true, triggers change notifications.
Ends the update block and triggers notifications with the specified event arguments.
public void EndUpdate(DataViewChangedEventArgs e)
The event arguments describing the view changes.
Resets the hierarchy data provider.
protected virtual void EnsureHierarchyProvider()
Ensures the type of the row.
protected virtual void EnsureRowType(GridViewTemplate gridViewTemplate)
The grid view template.
Expands all expandable rows.
public void ExpandAll()
Expands all group rows when data is grouped.
public void ExpandAllGroups()
protected virtual GridViewRowInfo GetDefaultCurrentRow(GridViewTemplate template, GridViewInfo viewInfo, bool checkItemCount)
Gets the event listener priority for this template.
protected virtual EventListenerPriority GetEventListenerPirotiy()
An EventListenerPriority value indicating the priority.
Gets the event processing mode for this template.
protected virtual GridEventProcessMode GetEventProcessMode()
A GridEventProcessMode value indicating the processing mode.
Loads data from an IDataReader and resets the current data source.
public void LoadFrom(IDataReader dataReader)
The data reader to load data from.
This method is used to notify the template, that a row is expanded, while event dispatch is suspended.
public virtual void NotifyRowExpanded()
Raises the event.
protected virtual void OnCreateRowInfo(GridViewCreateRowInfoEventArgs e)
The GridViewCreateRowInfoEventArgs instance containing the event data.
Raises the PropertyChanged event.
protected virtual void OnNotifyPropertyChanged(PropertyChangedEventArgs e)
The event arguments containing the property change information.
Raises the PropertyChanged event for the specified property.
protected virtual void OnNotifyPropertyChanged(string propertyName)
The name of the property that changed.
Raises the PropertyChanging event. Note: This method is called even when the notifications are suspended.
protected virtual void OnPropertyChanging(PropertyChangingEventArgsEx e)
A PropertyChangingEventArgsEx instance containing event data.
Raises the PropertyChanging event for the specified property.
Raises the event.
protected void OnViewChanged(DataViewChangedEventArgs e)
The DataViewChangedEventArgs instance containing the event data.
Called when the view is changed.
protected virtual void OnViewChanged(object sender, DataViewChangedEventArgs e)
The sender.
eDataViewChangedEventArgsThe DataViewChangedEventArgs instance containing the event data.
Post-processes a grid view event.
protected virtual GridViewEventResult PostProcessEventCore(GridViewEvent eventData)
The event data to process.
Returns:A GridViewEventResult indicating the result of the processing.
Pre-processes a grid view event.
protected virtual GridViewEventResult PreProcessEventCore(GridViewEvent eventData)
The event data to pre-process.
Returns:A GridViewEventResult indicating the result of the pre-processing.
Processes a column property changed event.
protected virtual GridViewEventResult ProcessColumnPropertyChangedEvent(GridViewColumn column, RadPropertyChangedEventArgs e)
The column whose property changed.
eRadPropertyChangedEventArgsThe event arguments containing property change information.
Returns:A GridViewEventResult indicating the result of the processing.
Processes a grid view event.
protected virtual GridViewEventResult ProcessEventCore(GridViewEvent eventData)
The event data to process.
Returns:A GridViewEventResult indicating the result of the processing.
Refreshes the grid view template by reloading data and updating the display.
public virtual void Refresh()
Refreshes the grid view template with data changes for the specified columns.
public virtual void Refresh(params GridViewColumn[] affectedColumns)
The columns that have been affected by data changes.
Resets the current column.
protected virtual void ResetCurrentColumn()
Resets the current row.
protected virtual void ResetCurrentRow()
Resumes the event.
protected virtual void ResumeEvent(KnownEvents eventId)
The event id.
Sets whether the alternating row color is enabled.
Sets an error for a grid view cell with the specified exception.
public void SetError(GridViewCellCancelEventArgs e, Exception exception)
The GridViewCellCancelEventArgs instance containing the event data.
exceptionExceptionThe exception that occurred.
Sets an error for a grid view cell with the specified message.
public void SetError(GridViewCellCancelEventArgs e, string message)
The GridViewCellCancelEventArgs instance containing the event data.
messagestringThe error message.
Sets an error using the specified data error event arguments.
public void SetError(GridViewDataErrorEventArgs e)
The GridViewDataErrorEventArgs containing error information.
General method for setting the value of the field related to the property that is modified. This method confirms that the old and new values are different, then fires the PropertyChanging event, then sets the given value to the supplied field, and fires the PropertyChanged event. Note: If the PropertyChanging event is canceled, the last two actions are not performed.
protected virtual bool SetProperty<T>(string propertyName, ref T propertyField, T value)
The name of the property, that will appear as propertyName in the PropertyChanging and PropertyChanged event args.
propertyFieldTThe field, that is related to the property.
valueTThe value that is to be set to the field in case the PropertyChanging event is not being Cancel.
Returns:true if new value is being set
Suspends the event.
protected virtual void SuspendEvent(KnownEvents eventId)
The event id.
Unwires event handlers for the template's internal events.
protected virtual void UnwireEvents()
Wires up event handlers for the template's internal events.
protected virtual void WireEvents()
Events
Occurs when the binding context has changed.
public event EventHandler BindingContextChanged
Implements:
Occurs when the instance of GridViewRowInfo is created.
public event GridViewCreateRowInfoEventHandler CreateRowInfo
Occurs when initialization of the component is completed.
[Browsable(false)]
public event EventHandler Initialized
Implements:
Occurs when a property value has changed.
public event PropertyChangedEventHandler PropertyChanged
Implements:
Occurs when a property value is changing.
public event PropertyChangingEventHandlerEx PropertyChanging
Implements:
Occurs when the view is changed.
public event DataViewChangedEventHandler ViewChanged