Class GridColumnBase
Represents a class that Provides base implementation for Columns in SfDataGrid.
Implements
Inherited Members
Namespace: Syncfusion.UI.Xaml.Grids
Assembly: Syncfusion.Grid.WinUI.dll
Syntax
public abstract class GridColumnBase : ColumnBase<SfGridBase>, IDisposable
Constructors
GridColumnBase()
Declaration
protected GridColumnBase()
Fields
ActualWidthProperty
Identifies the ActualWidth dependency property.
Declaration
public static readonly DependencyProperty ActualWidthProperty
Field Value
Type |
---|
Microsoft.UI.Xaml.DependencyProperty |
Remarks
The identifier for the ActualWidth dependency property.
AllowEditingProperty
Identifies the AllowEditing dependency property.
Declaration
public static readonly DependencyProperty AllowEditingProperty
Field Value
Type |
---|
Microsoft.UI.Xaml.DependencyProperty |
Remarks
The identifier for the AllowEditing dependency property.
AllowFocusProperty
Identifies the AllowFocus dependency property.
Declaration
public static readonly DependencyProperty AllowFocusProperty
Field Value
Type |
---|
Microsoft.UI.Xaml.DependencyProperty |
Remarks
The identifier for the AllowFocus dependency property.
AllowSortingProperty
Identifies the AllowSorting dependency property.
Declaration
public static readonly DependencyProperty AllowSortingProperty
Field Value
Type |
---|
Microsoft.UI.Xaml.DependencyProperty |
Remarks
The identifier for the AllowSorting dependency property.
CellStyleProperty
Identifies the CellStyle dependency property.
Declaration
public static readonly DependencyProperty CellStyleProperty
Field Value
Type |
---|
Microsoft.UI.Xaml.DependencyProperty |
Remarks
The identifier for the CellStyle dependency property.
CellStyleSelectorProperty
Identifies the CellStyleSelector dependency property.
Declaration
public static readonly DependencyProperty CellStyleSelectorProperty
Field Value
Type |
---|
Microsoft.UI.Xaml.DependencyProperty |
Remarks
The identifier for the CellStyleSelector dependency property.
CellTemplateProperty
Identifies the CellTemplate dependency property.
Declaration
public static readonly DependencyProperty CellTemplateProperty
Field Value
Type |
---|
Microsoft.UI.Xaml.DependencyProperty |
Remarks
The identifier for the CellTemplate dependency property.
CellTemplateSelectorProperty
Identifies the CellTemplateSelector dependency property.
Declaration
public static readonly DependencyProperty CellTemplateSelectorProperty
Field Value
Type |
---|
Microsoft.UI.Xaml.DependencyProperty |
Remarks
The identifier for the CellTemplateSelector dependency property.
DataValidationModeProperty
Identifies the DataValidationMode dependency property.
Declaration
public static readonly DependencyProperty DataValidationModeProperty
Field Value
Type |
---|
Microsoft.UI.Xaml.DependencyProperty |
Remarks
The identifier for the DataValidationMode dependency property.
HeaderStyleProperty
Identifies the HeaderStyle dependency property.
Declaration
public static readonly DependencyProperty HeaderStyleProperty
Field Value
Type |
---|
Microsoft.UI.Xaml.DependencyProperty |
Remarks
The identifier for the HeaderStyle dependency property.
HeaderTemplateProperty
Identifies the HeaderTemplate dependency property.
Declaration
public static readonly DependencyProperty HeaderTemplateProperty
Field Value
Type |
---|
Microsoft.UI.Xaml.DependencyProperty |
Remarks
The identifier for the HeaderTemplate dependency property.
HeaderTextProperty
Identifies the HeaderText dependency property.
Declaration
public static readonly DependencyProperty HeaderTextProperty
Field Value
Type |
---|
Microsoft.UI.Xaml.DependencyProperty |
Remarks
The identifier for the HeaderText dependency property.
HeaderToolTipTemplateProperty
Identifies the HeaderToolTipTemplate dependency property.
Declaration
public static readonly DependencyProperty HeaderToolTipTemplateProperty
Field Value
Type |
---|
Microsoft.UI.Xaml.DependencyProperty |
Remarks
The identifier for the HeaderToolTipTemplate dependency property.
HorizontalHeaderContentAlignmentProperty
Identifies the HorizontalHeaderContentAlignment dependency property.
Declaration
public static readonly DependencyProperty HorizontalHeaderContentAlignmentProperty
Field Value
Type |
---|
Microsoft.UI.Xaml.DependencyProperty |
Remarks
The identifier for the HorizontalHeaderContentAlignment dependency property.
IsHiddenProperty
Identifies the IsHidden dependency property.
Declaration
public static readonly DependencyProperty IsHiddenProperty
Field Value
Type |
---|
Microsoft.UI.Xaml.DependencyProperty |
Remarks
The identifier for the IsHidden dependency property.
IsReadOnlyProperty
Identifies the IsReadOnly dependency property.
Declaration
public static readonly DependencyProperty IsReadOnlyProperty
Field Value
Type |
---|
Microsoft.UI.Xaml.DependencyProperty |
Remarks
The identifier for the IsReadOnly dependency property.
MappingNameProperty
Identifies the MappingName dependency property.
Declaration
public static readonly DependencyProperty MappingNameProperty
Field Value
Type |
---|
Microsoft.UI.Xaml.DependencyProperty |
Remarks
The identifier for the MappingName dependency property.
MaximumWidthProperty
Identifies the MaximumWidth dependency property.
Declaration
public static readonly DependencyProperty MaximumWidthProperty
Field Value
Type |
---|
Microsoft.UI.Xaml.DependencyProperty |
Remarks
The identifier for the MaximumWidth dependency property.
MinimumWidthProperty
Identifies the MinimumWidth dependency property.
Declaration
public static readonly DependencyProperty MinimumWidthProperty
Field Value
Type |
---|
Microsoft.UI.Xaml.DependencyProperty |
Remarks
The identifier for the MinimumWidth dependency property.
PaddingProperty
Identifies the Padding dependency property.
Declaration
public static readonly DependencyProperty PaddingProperty
Field Value
Type |
---|
Microsoft.UI.Xaml.DependencyProperty |
Remarks
The identifier for the Padding dependency property.
SetCellBoundToolTipProperty
Identifies the SetCellBoundToolTip dependency property.
Declaration
public static readonly DependencyProperty SetCellBoundToolTipProperty
Field Value
Type |
---|
Microsoft.UI.Xaml.DependencyProperty |
Remarks
The identifier for the SetCellBoundToolTip dependency property.
SetCellBoundValueProperty
Identifies the SetCellBoundValue dependency property.
Declaration
public static readonly DependencyProperty SetCellBoundValueProperty
Field Value
Type |
---|
Microsoft.UI.Xaml.DependencyProperty |
Remarks
The identifier for the SetCellBoundValue dependency property.
ShowHeaderToolTipProperty
Identifies the ShowHeaderToolTip dependency property.
Declaration
public static readonly DependencyProperty ShowHeaderToolTipProperty
Field Value
Type |
---|
Microsoft.UI.Xaml.DependencyProperty |
Remarks
The identifier for the ShowHeaderToolTip dependency property.
ShowToolTipProperty
Identifies the ShowToolTip dependency property.
Declaration
public static readonly DependencyProperty ShowToolTipProperty
Field Value
Type |
---|
Microsoft.UI.Xaml.DependencyProperty |
Remarks
The identifier for the ShowToolTip dependency property.
TextAlignmentProperty
Identifies the TextAlignment dependency property.
Declaration
public static readonly DependencyProperty TextAlignmentProperty
Field Value
Type |
---|
Microsoft.UI.Xaml.DependencyProperty |
Remarks
The identifier for the TextAlignment dependency property.
ToolTipTemplateProperty
Identifies the ToolTipTemplate dependency property.
Declaration
public static readonly DependencyProperty ToolTipTemplateProperty
Field Value
Type |
---|
Microsoft.UI.Xaml.DependencyProperty |
Remarks
The identifier for the ToolTipTemplate dependency property.
ToolTipTemplateSelectorProperty
Identifies the ToolTipTemplateSelector dependency property.
Declaration
public static readonly DependencyProperty ToolTipTemplateSelectorProperty
Field Value
Type |
---|
Microsoft.UI.Xaml.DependencyProperty |
Remarks
The identifier for the ToolTipTemplateSelector dependency property.
UpdateTriggerProperty
Identifies the UpdateTrigger dependency property.
Declaration
public static readonly DependencyProperty UpdateTriggerProperty
Field Value
Type |
---|
Microsoft.UI.Xaml.DependencyProperty |
Remarks
The identifier for the UpdateTrigger dependency property.
VerticalAlignmentProperty
Identifies the VerticalAlignment dependency property.
Declaration
public static readonly DependencyProperty VerticalAlignmentProperty
Field Value
Type |
---|
Microsoft.UI.Xaml.DependencyProperty |
Remarks
The identifier for the VerticalAlignment dependency property.
WidthProperty
Identifies the Width dependency property.
Declaration
public static readonly DependencyProperty WidthProperty
Field Value
Type |
---|
Microsoft.UI.Xaml.DependencyProperty |
Remarks
The identifier for the Width dependency property.
Properties
ActualWidth
Gets the actual width of the column.
Declaration
public double ActualWidth { get; }
Property Value
Type | Description |
---|---|
System.Double | The actual width of the column. The default value is Double.NaN. |
Remarks
This value is calculated based on the width inputs.
See Also
AllowEditing
Gets or sets a value that indicates whether user can edit the cells of the column.
Declaration
public bool AllowEditing { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | true if the user can edit the cell of the column; otherwise, false. The default value is false. |
Remarks
This property will takes higher priority than AllowEditing property. CurrentCellBeginEdit and CurrentCellEndEdit events occurs when editing starts for current cell and editing ends for current cell in SfDataGrid. CurrentCellBeginEdit and CurrentCellEndEdit events occurs when editing starts for current cell and editing ends for current cell in SfTreeGrid.
See Also
AllowFocus
Gets or sets a value that indicates whether the cells of the column enabled for user interaction like selection, editing and etc.
Declaration
public bool AllowFocus { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | true if the column allows user interactions like selection and editing; otherwise, false. The default value is true. |
Remarks
If this property is set to false, mouse or keyboard interaction cannot be performed in the column.
AllowSorting
Gets or sets a value that indicates whether the user can sort the data by clicking on its header cell of column.
Declaration
public bool AllowSorting { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | true if the user can sort the data by clicking column header; otherwise, false. The default value is true. |
Remarks
This property will takes higher priority than AllowSorting. For SfDataGrid, the SortColumnsChanging and SortColumnsChanged events occurs , when the sorting operation is performed. For SfTreeGrid, the SortColumnsChanging and SortColumnsChanged events occurs , when the sorting operation is performed. In SfDataGrid you can cancel or customize the sorting operation through SortColumnsChanging event handler. In SfTreeGrid you can cancel or customize the sorting operation through SortColumnsChanging event handler.
See Also
CellStyle
Gets or sets the style applied to all the cells in column.
Declaration
public Style CellStyle { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.UI.Xaml.Style | The style that is applied to all the record cells in column. The default value is null. |
Remarks
This property will takes higher priority than CellStyle property. To define a Microsoft.UI.Xaml.Style for a cell, specify a TargetType of GridCell or TreeGridCell.
Examples
<Page.Resources>
<Style TargetType="dataGrid:GridCell" x:Key="cellStyle">
<Setter Property="Foreground" Value="DarkBlue"/>
</Style>
</Page.Resources>
<dataGrid:SfDataGrid.Columns>
<dataGrid:GridTextColumn MappingName = "OrderID" HeaderText="Order ID" CellStyle="{StaticResource cellStyle}"/>
</dataGrid:SfDataGrid.Columns>
See Also
CellStyleSelector
Gets or sets the style applied to record cell conditionally based on data in GridColumn.
Declaration
public StyleSelector CellStyleSelector { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.UI.Xaml.Controls.StyleSelector | A Microsoft.UI.Xaml.Controls.StyleSelector object that chooses the style to cell based on data. The default value is null. |
Remarks
This property will takes higher priority than CellStyleSelector property. To define a Microsoft.UI.Xaml.Style for a cell, specify a TargetType of GridCell or TreeGridCell.
Examples
public class SelectorClass : StyleSelector
{
protected override Style SelectStyleCore(object item, DependencyObject container)
{
var data = item as OrderInfo;
if (data != null && ((container as GridCell).ColumnBase.GridColumn.MappingName == "OrderID"))
{
//custom condition is checked based on data.
if (data.OrderID < 1005)
return App.Current.Resources["redCellStyle"] as Style;
return App.Current.Resources["blueCellStyle"] as Style;
}
return base.SelectStyleCore(item, container);
}
}
<Application.Resources>
<local:SelectorClass x:Key="styleSelector"/>
<Style x:Key="redCellStyle" TargetType="dataGrid:GridCell">
<Setter Property="Foreground" Value="Red" />
</Style>
<Style x:Key="blueCellStyle" TargetType="dataGrid:GridCell">
<Setter Property="Foreground" Value="DarkBlue" />
</Style>
</Application.Resources>
<dataGrid:SfDataGrid x:Name="dataGrid"
AutoGenerateColumns="False"
CellStyleSelector="{StaticResource styleSelector}"
ItemsSource="{Binding Orders}"
ColumnWidthMode="Star">
<dataGrid:SfDataGrid.Columns>
<dataGrid:GridTextColumn MappingName="OrderID" HeaderText="Order ID" />
<dataGrid:GridTextColumn MappingName="CustomerID" HeaderText="Customer ID" />
<dataGrid:GridTextColumn MappingName="CustomerName" HeaderText="Customer Name" />
<dataGrid:GridTextColumn MappingName="ShipCity" HeaderText="Ship City" />
<dataGrid:GridTextColumn MappingName="Country" />
</dataGrid:SfDataGrid.Columns>
</dataGrid:SfDataGrid>
See Also
CellTemplate
Gets or sets the Microsoft.UI.Xaml.DataTemplate that is used to display the contents of a cell that is in display mode.
Declaration
public DataTemplate CellTemplate { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.UI.Xaml.DataTemplate | The template that is used to display the contents of cell in a column that is in display mode. The default value is null. |
Remarks
The SetCellBoundValue decides whether the data context of the CellTemplate is based on Record or Syncfusion.UI.Xaml.DataGrid.Renderers.DataContextHelper class.
By default ,the Record is set as the DataContext for template. If SetCellBoundValue is true, the Syncfusion.UI.Xaml.DataGrid.Renderers.DataContextHelper will be set.
To define template for a cell that is in edit mode, use EditTemplate.
Examples
<syncfusion:SfDataGrid x:Name="dataGrid"
AutoGenerateColumns="False"
ItemsSource="{Binding Orders}">
<syncfusion:SfDataGrid.Columns>
<syncfusion:GridTemplateColumn MappingName="CustomerID">
<syncfusion:GridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding CustomerID}" />
</DataTemplate>
</syncfusion:GridTemplateColumn.CellTemplate>
<syncfusion:GridTemplateColumn.EditTemplate>
<DataTemplate>
<TextBox Text="{Binding CustomerID, Mode=TwoWay}" />
</DataTemplate>
</syncfusion:GridTemplateColumn.EditTemplate>
</syncfusion:GridTemplateColumn>
</syncfusion:SfDataGrid.Columns>
</syncfusion:SfDataGrid>
See Also
CellTemplateSelector
Gets or sets the Microsoft.UI.Xaml.DataTemplate by choosing a template based on data.
Declaration
public DataTemplateSelector CellTemplateSelector { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.UI.Xaml.Controls.DataTemplateSelector | A custom Microsoft.UI.Xaml.Controls.DataTemplateSelector object that chooses the Microsoft.UI.Xaml.DataTemplate based on data. The default value is null. |
Remarks
This property will takes higher priority than CellTemplateSelector property.
Examples
// control may be SfDataGrid or SfTreeGrid.
<Application.Resources>
<ResourceDictionary>
<local:CustomCellTemplateSelector x:Key="cellTemplateSelector"/>
<DataTemplate x:Key="DefaultTemplate">
<TextBlock Foreground="Red"
Text="{Binding Path=OrderID}"
TextAlignment="Center" />
</DataTemplate>
<DataTemplate x:Key="AlternateTemplate">
<TextBlock Foreground="Green"
Text="{Binding Path=OrderID}"
TextAlignment="Center" />
</DataTemplate>
</ResourceDictionary>
</Application.Resources>
<dataGrid:SfDataGrid x:Name="sfDataGrid"
ItemsSource="{Binding Orders}"
AutoGenerateColumns="False">
<dataGrid:SfDataGrid.Columns>
<dataGrid:GridTextColumn MappingName="OrderID" CellTemplateSelector="{StaticResource cellTemplateSelector}"/>
<dataGrid:GridTextColumn MappingName="CustomerID"/>
<dataGrid:GridTextColumn MappingName="CustomerName"/>
<dataGrid:GridTextColumn MappingName="ShipCity"/>
<dataGrid:GridTextColumn MappingName="Country"/>
</dataGrid:SfDataGrid.Columns>
</dataGrid:SfDataGrid>
See Also
DataValidationMode
Gets or sets a value to enable the built-in validation (INotifyDataErrorInfo/DataAnnonations) to validate the user input and displays the error.
Declaration
public GridValidationMode DataValidationMode { get; set; }
Property Value
Type | Description |
---|---|
GridValidationMode | One of the GridValidationMode enumeration that specifies how the cells are validated with in the column. The default mode is None. |
Remarks
This property will takes higher priority than DataValidationMode property. The DataValidationMode process the built-in validations when data object implements Microsoft.UI.Xaml.Data.INotifyDataErrorInfo and System.ComponentModel.DataAnnotations. The validation can also be done using CurrentCellValidating and RowValidating events in SfDataGrid and SfTreeGrid.
See Also
DisplayBinding
Gets or sets the data item to bind to display element of column.
Declaration
public BindingBase DisplayBinding { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.UI.Xaml.Data.BindingBase | The specified data item that displays in the column. |
Remarks
You can format the binding by setting Microsoft.UI.Xaml.Data.Binding.Converter.
HeaderStyle
Gets or sets the style applied to the header cell in GridColumn.
Declaration
public Style HeaderStyle { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.UI.Xaml.Style | The style that is applied to the header cell in GridColumn. The default value is null. |
Remarks
This property will takes higher priority than HeaderStyle property. To define a Microsoft.UI.Xaml.Style for a header cell, specify a TargetType of GridHeaderCellControl.
Examples
<Page.Resources>
<Style TargetType = "dataGrid:GridHeaderCellControl" x:Key="headerStyle">
<Setter Property = "FontWeight" Value="Bold"/>
<Setter Property = "FontSize" Value="14"/>
<Setter Property = "Foreground" Value="DarkBlue"/>
</Style>
</Page.Resources>
<dataGrid:SfDataGrid ItemsSource = "{Binding Orders}" AutoGenerateColumns="False">
<dataGrid:SfDataGrid.Columns>
<dataGrid:GridTextColumn MappingName = "OrderID" HeaderText="Order ID" HeaderStyle="{StaticResource headerStyle}"/>
</dataGrid:SfDataGrid.Columns>
</dataGrid:SfDataGrid>
See Also
HeaderTemplate
Gets or sets Microsoft.UI.Xaml.DataTemplate that defines the visual representation of the header cell in GridColumn.
Declaration
public DataTemplate HeaderTemplate { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.UI.Xaml.DataTemplate | The object that defines the visual representation of the header cell in GridColumn. The default value is null. |
Remarks
This property will takes higher priority than HeaderTemplate property.
Examples
<Page.Resources>
<DataTemplate x:Key="headerTemplate">
<Grid>
<TextBlock VerticalAlignment = "Center"
Foreground="DarkBlue" Text="{Binding}" />
</Grid>
</DataTemplate>
</Page.Resources>
<syncfuion:SfDataGrid ItemsSource = "{Binding Orders}" AutoGenerateColumns="False">
<syncfuion:SfDataGrid.Columns>
<syncfuion:GridTextColumn MappingName = "OrderID" HeaderText="Order ID" HeaderTemplate="{StaticResource headerTemplate}"/>
</syncfuion:SfDataGrid.Columns>
</syncfuion:SfDataGrid>
See Also
HeaderText
Gets or sets the text that is displayed on the header cell of column.
Declaration
public string HeaderText { get; set; }
Property Value
Type | Description |
---|---|
System.String | A string that is displayed on the header cell of column. |
Remarks
This property specify or determine the text displayed in the header text of the column. If user not provide header text, the mapping name will be displayed in the header text of the column.
See Also
HeaderToolTipTemplate
Gets or sets Microsoft.UI.Xaml.DataTemplate that defines the visual representation of tool tip for header cell in corresponding column.
Declaration
public DataTemplate HeaderToolTipTemplate { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.UI.Xaml.DataTemplate | The object that defines the visual representation of tool tip for header cell in corresponding column. The default value is null. |
Examples
<Page.Resources>
<DataTemplate x:Key="ToolTipTemplate">
<Grid>
<Rectangle Fill = "Transparent" />
< TextBlock Text="Order ID" FontWeight="Bold" Foreground="Red" />
</Grid>
</DataTemplate>
</Page.Resources>
<dataGrid:SfDataGrid ItemsSource = "{Binding Orders}" AutoGenerateColumns="False">
<dataGrid:SfDataGrid.Columns>
<dataGrid:GridTextColumn MappingName = "OrderID" HeaderText="Order ID"
ShowHeaderToolTip="True" HeaderToolTipTemplate ="{StaticResource ToolTipTemplate}"/>
</dataGrid:SfDataGrid.Columns>
</dataGrid:SfDataGrid>
See Also
HorizontalHeaderContentAlignment
Gets or sets the horizontal alignment for the header content of the column.
Declaration
public HorizontalAlignment HorizontalHeaderContentAlignment { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.UI.Xaml.HorizontalAlignment | One of the Microsoft.UI.Xaml.HorizontalAlignment enumeration that aligns the header content horizontally. |
IsAutoGenerated
Gets a value that determines whether the column is generated automatically.
Declaration
public bool IsAutoGenerated { get; }
Property Value
Type | Description |
---|---|
System.Boolean | true if the column is generated automatically; otherwise, false. |
See Also
IsHidden
Gets or sets a value that indicates whether the column is hidden from the view.
Declaration
public bool IsHidden { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | true if the column is hidden from the view; otherwise, false. The default value is false. |
IsReadOnly
Gets or sets the value that determines if the user can change the text in the GridCell.
Declaration
public bool IsReadOnly { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | true if the GridCell is in read-only state; otherwise, false. The default value is false. |
Remarks
This property will takes higher priority than IsReadOnly property. If the GridCell is read-only state, no user input or edits are allowed, but programmatic changes can be made. The user can still select text, and the key events are marked as handled. The difference between the AllowEditing and IsReadOnly behavior is user input. AllowEditing allows the user inputs but IsReadOnly won't allow.
IsTemplate
Denotes whether the column is type of GridTemplateColumn.
Declaration
protected bool IsTemplate { get; set; }
Property Value
Type |
---|
System.Boolean |
MappingName
Gets or sets the name to map the data member in the underlying data object.
Declaration
public string MappingName { get; set; }
Property Value
Type | Description |
---|---|
System.String | The name that maps the data member in the underlying data object. The default value is null. |
Remarks
If column is added manually, mapping name should not be null.
MaximumWidth
Gets or sets the upper bound for the width of the column.
Declaration
public double MaximumWidth { get; set; }
Property Value
Type | Description |
---|---|
System.Double | The maximum width constraint for the column .The default value is Double.NaN . |
Remarks
The column width could not be set or auto sized greater than the MaximumWidth.
See Also
MinimumWidth
Gets or sets the lower bound for the width of the column.
Declaration
public double MinimumWidth { get; set; }
Property Value
Type | Description |
---|---|
System.Double | The minimum width constraint of the column. The default value is Double.NaN. |
Remarks
The column width could not be set or auto sized lesser than the MinimumWidth.
See Also
Padding
Gets or sets the space between the edge of the cell and its content of the column.
Declaration
public Thickness Padding { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.UI.Xaml.Thickness | The space between the edge of the cell and its content in the column. |
SetCellBoundToolTip
Gets or sets a value that indicates whether the data context of ToolTipTemplate is Syncfusion.UI.Xaml.DataGrid.Renderers.DataContextHelper instead of Record.
Declaration
public bool SetCellBoundToolTip { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | true if data context of tool tip template is based on DataContextHelper class; otherwise, false. The default value is false. |
Remarks
The SetCellBoundToolTip allows you to bind value based on MappingName property. So, you can reuse the same template to more than one columns. with regardless of MappingName.
SetCellBoundValue
Gets or sets a value that indicates whether the data context of CellTemplate or EditTemplate is Syncfusion.UI.Xaml.DataGrid.Renderers.DataContextHelper instead of Record.
Declaration
public bool SetCellBoundValue { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | true if the data context of cell or edit template is DataContextHelper class; otherwise, false. The default value is false. |
Remarks
The SetCellBoundValue allows you to bind value based on MappingName property. So, you can reuse the same template to more than one columns. with regardless of MappingName.
ShowHeaderToolTip
Gets or sets value that indicates whether the tool tip should be displayed when mouse hovered on the header cell.
Declaration
public bool ShowHeaderToolTip { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | true if the tool tip is enabled on the header cell of column; otherwise, false. The default value is false. |
See Also
ShowToolTip
Gets or sets value that indicates whether the tool tip is enabled in a particular column.
Declaration
public bool ShowToolTip { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | true if the tool tip is enabled in the column; otherwise, false. The default value is false. |
Remarks
This property will takes higher priority than ShowToolTip property.
TextAlignment
Gets or sets the horizontal alignment property for the text.
Declaration
public TextAlignment TextAlignment { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.UI.Xaml.TextAlignment | One of the Microsoft.UI.Xaml.TextAlignment enumeration that specifies the horizontal alignment for the text. The default value Microsoft.UI.Xaml.TextAlignment.Left. |
ToolTipTemplate
Gets or sets the Microsoft.UI.Xaml.DataTemplate that defines the visual representation of a tool tip for the record cell in a corresponding column.
Declaration
public DataTemplate ToolTipTemplate { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.UI.Xaml.DataTemplate | The object that defines the visual representation of tool tip for the record cell in corresponding column. The default value is null. |
Remarks
The SetCellBoundToolTip decides whether the data context of the ToolTipTemplate is based on record or Syncfusion.UI.Xaml.DataGrid.Renderers.DataContextHelper/Syncfusion.UI.Xaml.TreeGrid.Renderers.TreeGridDataContextHelper class.
By default, record will be the DataContext of ToolTipTemplate. If SetCellBoundValue is true, the Syncfusion.UI.Xaml.DataGrid.Renderers.DataContextHelper or Syncfusion.UI.Xaml.TreeGrid.Renderers.TreeGridDataContextHelper will be act as data context.
Examples
<syncfusion:SfDataGrid x:Name="dataGrid" AutoGenerateColumns="False" ItemsSource="{Binding Orders}" >
<syncfusion:SfDataGrid.Resources>
<local:StringToImageConverter x:Key="ImageConverter" />
<DataTemplate x:Key="TemplateToolTip">
<Image Height="100" Width="100" Source="{Binding CustomerID,Converter={StaticResource ImageConverter}}" />
</DataTemplate>
</syncfusion:SfDataGrid.Resources>
<syncfusion:SfDataGrid.Columns>
<syncfusion:GridTextColumn HeaderText="Order ID" ShowToolTip="True" MappingName="OrderID" />
<syncfusion:GridTextColumn HeaderText="Customer ID" ToolTipTemplate="{StaticResource TemplateToolTip}" ShowToolTip="True" MappingName="CustomerID" />
</syncfusion:SfDataGrid.Columns>
</syncfusion:SfDataGrid>
ToolTipTemplateSelector
Gets or sets the Microsoft.UI.Xaml.Controls.DataTemplateSelector based on custom logic for tool-tip content.
Declaration
public DataTemplateSelector ToolTipTemplateSelector { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.UI.Xaml.Controls.DataTemplateSelector | A custom Microsoft.UI.Xaml.Controls.DataTemplateSelector object that provides logic and returns a Microsoft.UI.Xaml.DataTemplate. The default value is null. |
Remarks
By default, the DataContext of the template is underlying business object. If SetCellBoundValue is true, then Syncfusion.UI.Xaml.DataGrid.Renderers.DataContextHelper or Syncfusion.UI.Xaml.TreeGrid.Renderers.TreeGridDataContextHelper will be the DataContext.
Examples
public class ToolTipTemplateSelector : DataTemplateSelector
{
private DataTemplate _defaultTemplate;
/// <summary>
/// Gets or sets DefaultTemplate.
/// </summary>
public DataTemplate DefaultTemplate
{
get { return _defaultTemplate; }
set { _defaultTemplate = value; }
}
private DataTemplate _alternateTemplate;
/// <summary>
/// Gets or Sets AlternateTemplate.
/// </summary>
public DataTemplate AlternateTemplate
{
get { return _alternateTemplate; }
set { _alternateTemplate = value; }
}
public override System.Windows.DataTemplate SelectTemplate(object item, System.Windows.DependencyObject container)
{
//The item that comes from ToolTipTemplate is DataContextHelper. When set SetCellBoundValue to true, it sets DataContextHelper as DataContext to DataTemplate. Refer property section of CellTemplate.
OrderInfo dataUnit = item as OrderInfo;
if (dataUnit == null) return this.DefaultTemplate;
//use reflection to retrieve property
Type type = dataUnit.GetType();
PropertyInfo property = type.GetProperty("OrderID");
//To see what template needs to be select according to the specified property value.
if (property.GetValue(dataUnit, null).ToString().Contains('9') || property.GetValue(dataUnit, null).ToString().Contains('4'))
return this.AlternateTemplate;
else
return this.DefaultTemplate;
}
}
<Page.Resources>
<DataTemplate x:Key="toolTip1">
<Grid>
<Rectangle Fill = "Transparent" />
< TextBlock Text="{Binding OrderID}" FontWeight="Bold" Foreground="Red" />
</Grid>
</DataTemplate>
<DataTemplate x:Key="toolTip2">
<Grid>
<Rectangle Fill = "Transparent" />
< TextBlock Text="{Binding OrderID}" FontStyle="Italic" Foreground="Green" />
</Grid>
</DataTemplate>
</Page.Resources>
<dataGrid:SfDataGrid.Columns>
<dataGrid:GridTextColumn HeaderText = "Order ID" ShowToolTip="True" MappingName="OrderID" >
<dataGrid:GridTextColumn.ToolTipTemplateSelector>
<local:ToolTipTemplateSelector AlternateTemplate = "{StaticResource toolTip2}" DefaultTemplate="{StaticResource toolTip1}" />
</dataGrid:GridTextColumn.ToolTipTemplateSelector>
</dataGrid:GridTextColumn>
</dataGrid:SfDataGrid.Columns>
UpdateTrigger
Gets or sets the timing of binding source updates in the column.
Declaration
public UpdateSourceTrigger UpdateTrigger { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.UI.Xaml.Data.UpdateSourceTrigger | One of the Microsoft.UI.Xaml.Data.UpdateSourceTrigger enumeration that specifies the timing of binding updates. The default value is Microsoft.UI.Xaml.Data.UpdateSourceTrigger.Default . |
ValueBinding
Gets or sets the data item to bind to the edit element of column.
Declaration
public BindingBase ValueBinding { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.UI.Xaml.Data.BindingBase | The specified data item that displays the edit element of column. |
Remarks
You can format the binding by setting Microsoft.UI.Xaml.Data.Binding.Converter.
VerticalAlignment
Gets or sets the vertical alignment for the cells of the column.
Declaration
public VerticalAlignment VerticalAlignment { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.UI.Xaml.VerticalAlignment | One of the Microsoft.UI.Xaml.VerticalAlignment enumeration that specifies the vertical alignment of the column. The default is Microsoft.UI.Xaml.VerticalAlignment.Center . |
Width
Gets or sets the width of column .
Declaration
public double Width { get; set; }
Property Value
Type | Description |
---|---|
System.Double | The width of column. The default value is Double.NaN. |
See Also
Methods
CanEditCell()
Determines whether the column is editable.
Declaration
protected virtual bool CanEditCell()
Returns
Type | Description |
---|---|
System.Boolean | By default, returns true |
Dispose(Boolean)
Disposes all the resources used by the GridColumnBase class.
Declaration
protected override void Dispose(bool isDisposing)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | isDisposing | Indicates whether the call is from Dispose method or from a finalizer. |
Overrides
OnCellTemplateChanged(DependencyPropertyChangedEventArgs)
Invoked when the CellTemplate dependency property value changed in the column.
Declaration
protected virtual void OnCellTemplateChanged(DependencyPropertyChangedEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.UI.Xaml.DependencyPropertyChangedEventArgs | e | The Microsoft.UI.Xaml.DependencyPropertyChangedEventArgs that contains data for CellTemplate dependency property changes. |
OnCellTemplateSelectorChanged(DependencyPropertyChangedEventArgs)
Invoked when the CellTemplateSelector dependency property is changed in column.
Declaration
protected virtual void OnCellTemplateSelectorChanged(DependencyPropertyChangedEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.UI.Xaml.DependencyPropertyChangedEventArgs | e | The Microsoft.UI.Xaml.DependencyPropertyChangedEventArgs that contains data for the CellTemplateSelector dependency property changes. |
OnUpdateBindingInfo(DependencyObject, DependencyPropertyChangedEventArgs)
Updates the binding for the property changes associated with column.
Declaration
public static void OnUpdateBindingInfo(DependencyObject d, DependencyPropertyChangedEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.UI.Xaml.DependencyObject | d | The dependency property that contains the property changes. |
Microsoft.UI.Xaml.DependencyPropertyChangedEventArgs | e | The System.DependencyPropertyChangedEventArgs instance that contains the data for various events. |
Exceptions
Type | Condition |
---|---|
System.ArgumentException | Thrown when the currency decimal separator has empty string in GridCurrencyColumn. |
System.ArgumentOutOfRangeException | Thrown when the currency positive pattern value is greater than 3 in GridCurrencyColumn. |
System.ArgumentOutOfRangeException | Thrown when the currency negative pattern value is greater that 15 in GridCurrencyColumn. |
System.ArgumentException | Thrown when the percent decimal separator has empty string in GridPercentColumn. |
System.ArgumentOutOfRangeException | Thrown when the percent positive pattern value is greater than 3 in GridPercentColumn. |
System.ArgumentOutOfRangeException | Thrown when the percent negative pattern value is greater that 11 in GridPercentColumn. |
System.ArgumentException | Thrown when the number decimal separator has empty string in GridNumericColumn. |
System.ArgumentOutOfRangeException | Thrown when the number negative pattern is greater than 4 in GridNumericColumn. |
SetDisplayBindingConverter()
Sets the converter for the DisplayBinding of column.
Declaration
protected virtual void SetDisplayBindingConverter()
Remarks
You can override this method to specify the converter for DisplayBinding.
SetValueBindingConverter()
Sets the converter for the ValueBinding of column.
Declaration
protected virtual void SetValueBindingConverter()
Remarks
You can override this method to specify the converter for ValueBinding.
UpdateBindingBasedOnAllowEditing()
Updates the binding for the AllowEdit property changes in the column.
Declaration
protected virtual void UpdateBindingBasedOnAllowEditing()
UpdateBindingForValidation(GridValidationMode)
Updates the binding for DataValidationMode property changes in the column.
Declaration
public void UpdateBindingForValidation(GridValidationMode gridValidationMode)
Parameters
Type | Name | Description |
---|---|---|
GridValidationMode | gridValidationMode | Specifies the corresponding validation mode for update binding. |