Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions wpf/TreeGrid/Clipboard-Operations.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ You can use the IncludeHeaders, IncludeFormat, and IncludeHiddenColumn options a
{% tabs %}
{% highlight xaml %}
<syncfusion:SfTreeGrid Name="treeGrid"
AutoExpandMode="RootNodesExpanded"
AutoGenerateColumns="False"
GridCopyOption="CopyData,IncludeHeaders"
ChildPropertyName="Children"
ColumnSizer="Star"
ExpanderColumn="FirstName"
ItemsSource="{Binding PersonDetails}"
NavigationMode="Row">
AutoExpandMode="RootNodesExpanded"
AutoGenerateColumns="False"
GridCopyOption="CopyData,IncludeHeaders"
ChildPropertyName="Children"
ColumnSizer="Star"
ExpanderColumn="FirstName"
ItemsSource="{Binding PersonDetails}"
NavigationMode="Row">
{% endhighlight %}
{% highlight c# %}

Expand Down
26 changes: 13 additions & 13 deletions wpf/TreeGrid/Column-Sizing.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,17 @@ Calculates the width of column based on header and cell contents. So that header
<code>FillColumn</code>
</td>
<td>

While setting the `TreeGrid.ColumnSizer` property, all column widths are calculated based on content of cell and last column fills the remaining space of grid. And possible to set any column to fill the remaining space instead of last column by setting `TreeGridColumn.ColumnSizer` as `FillColumn` for that particular column.
</td>
</tr>
<tr>
<td>
<code>AutoFillColumn</code>
</td>
While setting the `TreeGrid.ColumnSizer` property, all column widths are calculated based on content of cell and the last column fills the remaining column width as auto fill. And possible to set any column to fill the remaining space instead of last column by setting `TreeGridColumn.ColumnSizer` as `AutoFillColumn` for that particular column.
<td>

While setting the `TreeGrid.ColumnSizer` property, all column widths are calculated based on content of cell and the last column fills the remaining column width as auto fill. And possible to set any column to fill the remaining space instead of last column by setting `TreeGridColumn.ColumnSizer` as `AutoFillColumn` for that particular column.
</td>
</tr>
<tr>
Expand Down Expand Up @@ -104,7 +106,7 @@ N> The `TreeGridColumn.ColumnSizer` takes higher priority than the `SfTreeGrid.C

### Refreshing ColumnSizer at runtime

You can refresh the `ColumnSizer` at runtime by calling [SfTreeGrid.TreeGridColumnSizer.Refresh](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.TreeGrid.TreeGridColumnSizer.html#Syncfusion_UI_Xaml_TreeGrid_TreeGridColumnSizer_Refresh().html) method.
You can refresh the `ColumnSizer` at runtime by calling [SfTreeGrid.TreeGridColumnSizer.Refresh](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.TreeGrid.TreeGridColumnSizer.html#Syncfusion_UI_Xaml_TreeGrid_TreeGridColumnSizer_Refresh) method.
SfTreeGrid support to recalculates the column auto width by calling reset methods of `TreeGridColumnSizer`. [TreeGridColumnSizer.ResetAutoCalculationforAllColumns](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.Grid.ColumnSizerBase-1.html#Syncfusion_UI_Xaml_Grid_ColumnSizerBase_1_ResetAutoCalculationforAllColumns) method reset widths to all columns. [TreeGridColumnSizer.ResetAutoCalculation](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.Grid.ColumnSizerBase-1.html#Syncfusion_UI_Xaml_Grid_ColumnSizerBase_1_ResetAutoCalculation_Syncfusion_UI_Xaml_Grid_GridColumnBase_) method reset the width to particular column.

N> The `TreeGridColumnSizer.ResetAutoCalculationforAllColumns` or `TreeGridColumnSizer.ResetAutoCalculation` methods applicable for Auto, FillColumn, AutoFillColumn, SizeToCells types.
Expand All @@ -129,17 +131,17 @@ When the width of the column is explicitly defined or column is resized, then co

foreach (var column in treeGrid.Columns)
{

if (!double.IsNaN(column.Width))
column.Width = double.NaN;
}
this.treeGrid.TreeGridColumnSizer.Refresh();

{% endhighlight %}
{% endtabs %}

### Customizing built-in column sizing logic

SfTreeGrid process column sizing operations in [TreeGridColumnSizer](http://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.Grid.GridColumnSizer.html) class. You can customize the column sizing operations by overriding `GridColumnSizer` and set it to `SfTreeGrid.TreeGridColumnSizer`.
SfTreeGrid process column sizing operations in [TreeGridColumnSizer](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.TreeGrid.TreeGridColumnSizer.html) class. You can customize the column sizing operations by overriding `GridColumnSizer` and set it to `SfTreeGrid.TreeGridColumnSizer`.

{% tabs %}
{% highlight c# %}
Expand Down Expand Up @@ -172,7 +174,7 @@ public class TreeGridColumnSizerExt:TreeGridColumnSizer

### Auto width calculation based on font settings

By default, the ColumnSizer calculates column&#39;s width based on fixed `FontSize`, `FontFamily`, `Margin`,`SortIconWidth`. You can change the calculation by customized settings.
By default, the ColumnSizer calculates column&#39;s width based on fixed `FontSize`, `FontFamily`, `Margin`, `SortIconWidth`. You can change the calculation by customized settings.

#### Changing SortIcon width

Expand Down Expand Up @@ -204,9 +206,9 @@ For example, you can calculate the column width, with specified ratios instead o

{% tabs %}
{% highlight c# %}

public static class StarRatio
{

public static int GetColumnRatio(DependencyObject obj)
{
return (int)obj.GetValue(ColumnRatioProperty);
Expand All @@ -219,19 +221,20 @@ public static class StarRatio

public static readonly DependencyProperty ColumnRatioProperty = DependencyProperty.RegisterAttached("ColumnRatio", typeof(int), typeof(StarRatio), new PropertyMetadata(1, null));
}

{% endhighlight %}
{% endtabs %}

Below code to define the star width calculation based on the `ColumnRatio`.

{% tabs %}
{% highlight c# %}

//Assign the customized TreeGridColumnSizerExt to SfTreeGrid.TreeGridColumnSizer
this.treeGrid.TreeGridColumnSizer = new TreeGridColumnSizerExt(treeGrid);

public class TreeGridColumnSizerExt : TreeGridColumnSizer
{

public TreeGridColumnSizerExt(SfTreeGrid treeGrid) : base(treeGrid)
{
}
Expand Down Expand Up @@ -267,7 +270,6 @@ public class TreeGridColumnSizerExt : TreeGridColumnSizer

foreach (var remColumn in removedColumn)
{

if (!columns.Contains(remColumn))
{
removedWidth += remColumn.ActualWidth;
Expand Down Expand Up @@ -335,19 +337,17 @@ Below code creates `CustomColumnSizer` to change the width of `TreeGridComboboxC

{% tabs %}
{% highlight c# %}

this.TreeGrid.TreeGridColumnSizer = new CustomColumnSizer(this.treeGrid);

public class CustomColumnSizer : TreeGridColumnSizer
{

public CustomColumnSizer(SfTreeGrid treeGrid)
: base(treeGrid)
public CustomColumnSizer(SfTreeGrid treeGrid) : base(treeGrid)
{
}

protected override double CalculateCellWidth(TreeGridColumn column)
{

if (column is TreeGridComboBoxColumn)
{
double colWidth = double.MaxValue;
Expand All @@ -365,11 +365,11 @@ public class CustomColumnSizer : TreeGridColumnSizer
var measureSize = MeasureText(clientSize, maximumComboItemsText, column, null, Syncfusion.UI.Xaml.Grid.GridQueryBounds.Width);
return measureSize.Width + SystemParameters.ScrollWidth;
}

else
return base.CalculateCellWidth(column);
}
}

{% endhighlight %}

{% endtabs %}
Expand Down
22 changes: 8 additions & 14 deletions wpf/TreeGrid/Columns.md
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ Keeps old columns in TreeGrid.Columns collection.

### Customize auto-generated columns

You can customize or cancel the generated column by handling [AutoGeneratingColumn](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.TreeGrid.SfTreeGrid.html) event. `AutoGeneratingColumn` event occurs when the individual column is auto-generated for public and non-static property of underlying data object.
You can customize or cancel the generated column by handling [AutoGeneratingColumn](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.TreeGrid.SfTreeGrid.html#Syncfusion_UI_Xaml_TreeGrid_SfTreeGrid_AutoGeneratingColumn) event. `AutoGeneratingColumn` event occurs when the individual column is auto-generated for public and non-static property of underlying data object.

{% tabs %}
{% highlight c# %}
Expand All @@ -263,11 +263,11 @@ In the below code, column generation for `ReportsTo` property is canceled by set

{% tabs %}
{% highlight c# %}

treeGrid.AutoGeneratingColumn += TreeGrid_AutoGeneratingColumn;

private void TreeGrid_AutoGeneratingColumn(object sender, TreeGridAutoGeneratingColumnEventArgs e)
{

if (e.Column.MappingName == "ReportsTo")
e.Cancel = true;
}
Expand All @@ -282,14 +282,13 @@ In the below code, column type for `Salary` property is changed to `TreeGridText

{% tabs %}
{% highlight c# %}

treeGrid.AutoGeneratingColumn += TreeGrid_AutoGeneratingColumn;

private void TreeGrid_AutoGeneratingColumn(object sender, TreeGridAutoGeneratingColumnEventArgs e)
{

if (e.Column.MappingName == "Salary")
{

if (e.Column is TreeGridNumericColumn)
e.Column = new TreeGridTextColumn() { MappingName = "Salary" };
}
Expand All @@ -309,7 +308,6 @@ treeGrid.AutoGeneratingColumn += TreeGrid_AutoGeneratingColumn;

private void TreeGrid_AutoGeneratingColumn(object sender, TreeGridAutoGeneratingColumnEventArgs e)
{

if (e.Column.MappingName == "Salary")
{
e.Column.AllowEditing = false;
Expand Down Expand Up @@ -346,7 +344,6 @@ treeGrid.AutoGeneratingColumn += TreeGrid_AutoGeneratingColumn;

private void TreeGrid_AutoGeneratingColumn(object sender, TreeGridAutoGeneratingColumnEventArgs e)
{

if (e.Column.MappingName == "FirstName")
{
e.Column.HeaderTemplate = this.Resources["headerTemplate"] as DataTemplate;
Expand Down Expand Up @@ -558,7 +555,7 @@ treeGrid.Columns.Add(new TreeGridTextColumn() { MappingName = "FirstName", Heade

### Accessing column

You can access the column through its column index or [TreeGridColumn.MappingName](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.Grid.GridColumnBase.html#Syncfusion_UI_Xaml_Grid_GridColumnBase_MappingName) from the SfTreeGrid.Columns collection.
You can access the column through its column index or [TreeGridColumn.MappingName](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.Grid.GridColumnBase.html#Syncfusion_UI_Xaml_Grid_GridColumnBase_MappingName) from the `SfTreeGrid.Columns` collection.

{% tabs %}
{% highlight c# %}
Expand Down Expand Up @@ -624,7 +621,7 @@ SfTreeGrid shows indication for hidden columns in column header and also allows

### Disable resizing

You can cancel resizing of particular column by setting [TreeGridColumn.AllowResizing](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.TreeGrid.TreeGridColumn.html#Syncfusion_UI_Xaml_TreeGrid_TreeGridColumn_AllowResizing) property to `false`. In another way, you can cancel the resizing by handling [SfTreeGrid.ResizingColumns](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.TreeGrid.SfTreeGrid.html) event. The `ResizingColumns` event occurs when you start dragging by resizing cursor on headers.
You can cancel resizing of particular column by setting [TreeGridColumn.AllowResizing](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.TreeGrid.TreeGridColumn.html#Syncfusion_UI_Xaml_TreeGrid_TreeGridColumn_AllowResizing) property to `false`. In another way, you can cancel the resizing by handling [SfTreeGrid.ResizingColumns](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.TreeGrid.SfTreeGrid.html#Syncfusion_UI_Xaml_TreeGrid_SfTreeGrid_ResizingColumns) event. The `ResizingColumns` event occurs when you start dragging by resizing cursor on headers.
[ResizingColumnsEventArgs](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.Grid.ResizingColumnsEventArgs.html) of `ResizingColumns` provides information about the columns’s index and width.

{% tabs %}
Expand Down Expand Up @@ -691,7 +688,7 @@ You can enable or disable dragging on particular column using [TreeGridColumn.Al
{% endtabs %}

### Disable column reordering
You can cancel the particular column dragging by handling [SfTreeGrid.ColumnDragging](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.TreeGrid.SfTreeGrid.html). `ColumnDragging` event occurs when you start dragging the column header.
You can cancel the particular column dragging by handling [SfTreeGrid.ColumnDragging](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.TreeGrid.SfTreeGrid.html#Syncfusion_UI_Xaml_TreeGrid_SfTreeGrid_ColumnDragging). `ColumnDragging` event occurs when you start dragging the column header.

[TreeGridColumnDraggingEventArgs](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.TreeGrid.TreeGridColumnDraggingEventArgs.html) of `ColumnDragging` event provides information about the column triggered this event.

Expand Down Expand Up @@ -811,25 +808,22 @@ string childColumns = string.Empty;

foreach (var stackedColumnName in removingColumns.ToList())
{

if (stackedColumnName.Equals("OrderID"))
{
removingColumns.Remove(stackedColumnName);
}

else
childColumns = childColumns + stackedColumnName + ",";
}

this.treeGrid.StackedHeaderRows[0].StackedColumns[0].ChildColumns = childColumns;
}

{% endhighlight %}
{% endtabs %}

### Changing Stacked Header Row Height

You can change the height of StackedHeaderRows by using [GetTreePanel.RowHeights](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.TreeGrid.TreeGridPanel.html) property.
You can change the height of StackedHeaderRows by using [GetTreePanel.RowHeights](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.TreeGrid.TreeGridPanel.html#Syncfusion_UI_Xaml_TreeGrid_TreeGridPanel_RowHeights) property.

{% tabs %}
{% highlight c# %}
Expand Down Expand Up @@ -872,7 +866,7 @@ public class ViewModel
{% endhighlight %}
{% endtabs %}

Below code, binds the `ViewModel.AllowEditing` property to `TreeGridColumn. AllowEditing` property.
Below code, binds the `ViewModel.AllowEditing` property to `TreeGridColumn.AllowEditing` property.
{% tabs %}
{% highlight xaml %}

Expand Down
Loading