You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: wpf/TreeGrid/Column-Sizing.md
+13-13Lines changed: 13 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -43,15 +43,17 @@ Calculates the width of column based on header and cell contents. So that header
43
43
<code>FillColumn</code>
44
44
</td>
45
45
<td>
46
+
46
47
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.
47
48
</td>
48
49
</tr>
49
50
<tr>
50
51
<td>
51
52
<code>AutoFillColumn</code>
52
53
</td>
53
-
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.
54
54
<td>
55
+
56
+
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.
55
57
</td>
56
58
</tr>
57
59
<tr>
@@ -104,7 +106,7 @@ N> The `TreeGridColumn.ColumnSizer` takes higher priority than the `SfTreeGrid.C
104
106
105
107
### Refreshing ColumnSizer at runtime
106
108
107
-
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.
109
+
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.
108
110
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.
109
111
110
112
N> The `TreeGridColumnSizer.ResetAutoCalculationforAllColumns` or `TreeGridColumnSizer.ResetAutoCalculation` methods applicable for Auto, FillColumn, AutoFillColumn, SizeToCells types.
@@ -129,17 +131,17 @@ When the width of the column is explicitly defined or column is resized, then co
129
131
130
132
foreach (var column in treeGrid.Columns)
131
133
{
132
-
133
134
if (!double.IsNaN(column.Width))
134
135
column.Width = double.NaN;
135
136
}
136
137
this.treeGrid.TreeGridColumnSizer.Refresh();
138
+
137
139
{% endhighlight %}
138
140
{% endtabs %}
139
141
140
142
### Customizing built-in column sizing logic
141
143
142
-
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`.
144
+
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`.
143
145
144
146
{% tabs %}
145
147
{% highlight c# %}
@@ -172,7 +174,7 @@ public class TreeGridColumnSizerExt:TreeGridColumnSizer
172
174
173
175
### Auto width calculation based on font settings
174
176
175
-
By default, the ColumnSizer calculates column's width based on fixed `FontSize`, `FontFamily`, `Margin`,`SortIconWidth`. You can change the calculation by customized settings.
177
+
By default, the ColumnSizer calculates column's width based on fixed `FontSize`, `FontFamily`, `Margin`,`SortIconWidth`. You can change the calculation by customized settings.
176
178
177
179
#### Changing SortIcon width
178
180
@@ -204,9 +206,9 @@ For example, you can calculate the column width, with specified ratios instead o
204
206
205
207
{% tabs %}
206
208
{% highlight c# %}
209
+
207
210
public static class StarRatio
208
211
{
209
-
210
212
public static int GetColumnRatio(DependencyObject obj)
211
213
{
212
214
return (int)obj.GetValue(ColumnRatioProperty);
@@ -219,19 +221,20 @@ public static class StarRatio
219
221
220
222
public static readonly DependencyProperty ColumnRatioProperty = DependencyProperty.RegisterAttached("ColumnRatio", typeof(int), typeof(StarRatio), new PropertyMetadata(1, null));
221
223
}
224
+
222
225
{% endhighlight %}
223
226
{% endtabs %}
224
227
225
228
Below code to define the star width calculation based on the `ColumnRatio`.
226
229
227
230
{% tabs %}
228
231
{% highlight c# %}
232
+
229
233
//Assign the customized TreeGridColumnSizerExt to SfTreeGrid.TreeGridColumnSizer
230
234
this.treeGrid.TreeGridColumnSizer = new TreeGridColumnSizerExt(treeGrid);
231
235
232
236
public class TreeGridColumnSizerExt : TreeGridColumnSizer
233
237
{
234
-
235
238
public TreeGridColumnSizerExt(SfTreeGrid treeGrid) : base(treeGrid)
236
239
{
237
240
}
@@ -267,7 +270,6 @@ public class TreeGridColumnSizerExt : TreeGridColumnSizer
267
270
268
271
foreach (var remColumn in removedColumn)
269
272
{
270
-
271
273
if (!columns.Contains(remColumn))
272
274
{
273
275
removedWidth += remColumn.ActualWidth;
@@ -335,19 +337,17 @@ Below code creates `CustomColumnSizer` to change the width of `TreeGridComboboxC
335
337
336
338
{% tabs %}
337
339
{% highlight c# %}
340
+
338
341
this.TreeGrid.TreeGridColumnSizer = new CustomColumnSizer(this.treeGrid);
339
342
340
343
public class CustomColumnSizer : TreeGridColumnSizer
341
344
{
342
-
343
-
public CustomColumnSizer(SfTreeGrid treeGrid)
344
-
: base(treeGrid)
345
+
public CustomColumnSizer(SfTreeGrid treeGrid) : base(treeGrid)
Copy file name to clipboardExpand all lines: wpf/TreeGrid/Columns.md
+8-14Lines changed: 8 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -240,7 +240,7 @@ Keeps old columns in TreeGrid.Columns collection.
240
240
241
241
### Customize auto-generated columns
242
242
243
-
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.
243
+
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.
244
244
245
245
{% tabs %}
246
246
{% highlight c# %}
@@ -263,11 +263,11 @@ In the below code, column generation for `ReportsTo` property is canceled by set
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.
558
+
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.
562
559
563
560
{% tabs %}
564
561
{% highlight c# %}
@@ -624,7 +621,7 @@ SfTreeGrid shows indication for hidden columns in column header and also allows
624
621
625
622
### Disable resizing
626
623
627
-
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.
624
+
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.
628
625
[ResizingColumnsEventArgs](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.Grid.ResizingColumnsEventArgs.html) of `ResizingColumns` provides information about the columns’s index and width.
629
626
630
627
{% tabs %}
@@ -691,7 +688,7 @@ You can enable or disable dragging on particular column using [TreeGridColumn.Al
691
688
{% endtabs %}
692
689
693
690
### Disable column reordering
694
-
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.
691
+
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.
695
692
696
693
[TreeGridColumnDraggingEventArgs](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.TreeGrid.TreeGridColumnDraggingEventArgs.html) of `ColumnDragging` event provides information about the column triggered this event.
You can change the height of StackedHeaderRows by using [GetTreePanel.RowHeights](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.TreeGrid.TreeGridPanel.html) property.
826
+
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.
833
827
834
828
{% tabs %}
835
829
{% highlight c# %}
@@ -872,7 +866,7 @@ public class ViewModel
872
866
{% endhighlight %}
873
867
{% endtabs %}
874
868
875
-
Below code, binds the `ViewModel.AllowEditing` property to `TreeGridColumn.AllowEditing` property.
869
+
Below code, binds the `ViewModel.AllowEditing` property to `TreeGridColumn.AllowEditing` property.
Copy file name to clipboardExpand all lines: wpf/TreeGrid/Data-Binding.md
+11-9Lines changed: 11 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,14 +10,14 @@ documentation: ug
10
10
# Data Binding in WPF TreeGrid (SfTreeGrid)
11
11
12
12
SfTreeGrid is designed to display the self-relational and hierarchical data in tree structure with columns. The data binding can be achieved by assigning the data source to [SfTreeGrid.ItemsSource](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.TreeGrid.SfTreeGrid.html#Syncfusion_UI_Xaml_TreeGrid_SfTreeGrid_ItemsSource) property directly through self-relational binding or nested collection or retrieving the parent and child nodes items dynamically using [RequestTreeItems](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.TreeGrid.SfTreeGrid.html#Syncfusion_UI_Xaml_TreeGrid_SfTreeGrid_RequestTreeItems) or [LoadOnDemandCommand](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.TreeGrid.SfTreeGrid.html#Syncfusion_UI_Xaml_TreeGrid_SfTreeGrid_LoadOnDemandCommand).
13
-
If the data source implements [INotifyCollectionChanged](https://learn.microsoft.com/en-us/dotnet/api/system.collections.specialized.inotifycollectionchanged?redirectedfrom=MSDN&view=net-5.0) interface, then SfTreeGrid control will automatically refresh the UI when item is added, removed or while list cleared. When you add, remove item in[ObservableCollection](https://learn.microsoft.com/en-us/dotnet/api/system.collections.objectmodel.observablecollection-1?redirectedfrom=MSDN&view=net-5.0)`, SfTreeGrid automatically refresh the UI as `ObservableCollection’ implements `INotifyCollectionChanged`. But when you do the same in [List](https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.list-1?redirectedfrom=MSDN&view=net-5.0), SfTreeGrid will not refresh the UI automatically.
13
+
If the data source implements [INotifyCollectionChanged](https://learn.microsoft.com/en-us/dotnet/api/system.collections.specialized.inotifycollectionchanged?redirectedfrom=MSDN&view=net-5.0) interface, then SfTreeGrid control will automatically refresh the UI when item is added, removed or while list cleared. When you add, remove item in[ObservableCollection](https://learn.microsoft.com/en-us/dotnet/api/system.collections.objectmodel.observablecollection-1?redirectedfrom=MSDN&view=net-5.0)`, SfTreeGrid automatically refresh the UI as `ObservableCollection implements `INotifyCollectionChanged`. But when you do the same in [List](https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.list-1?redirectedfrom=MSDN&view=net-5.0), SfTreeGrid will not refresh the UI automatically.
14
14
15
15
Below are the ways to bind the data source to SfTreeGrid.
16
16
17
17
*[Populate data using self-relational binding](https://help.syncfusion.com/wpf/treegrid/getting-started#binding-self-relational-data-in-sftreegrid)
18
18
*[Populate data using nested collection](https://help.syncfusion.com/wpf/treegrid/getting-started#binding-nested-collection-with-sftreegrid)
19
-
*[Populate data with `RequestTreeItems` event](https://help.syncfusion.com/wpf/treegrid/load-on-demand#using-requesttreeitems-event)
20
-
*[Populate data with `LoadOnDemandCommand`](https://help.syncfusion.com/wpf/treegrid/load-on-demand#using-loadondemandcommand)
19
+
*[Populate data with RequestTreeItems event](https://help.syncfusion.com/wpf/treegrid/load-on-demand#using-requesttreeitems-event)
20
+
*[Populate data with LoadOnDemandCommand](https://help.syncfusion.com/wpf/treegrid/load-on-demand#using-loadondemandcommand)
21
21
22
22
## Binding with IEnumerable
23
23
@@ -269,14 +269,15 @@ You can cancel the specific node being expanded by using `SfTreeGrid.NodeExpandi
You can get the notification once a node is collapsed from [TreeGrid.NodeCollapsed](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.TreeGrid.SfTreeGrid.html) event and here you can get the collapsed node.
430
+
You can get the notification once a node is collapsed from [TreeGrid.NodeCollapsed](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.TreeGrid.SfTreeGrid.html#Syncfusion_UI_Xaml_TreeGrid_SfTreeGrid_NodeCollapsed) event and here you can get the collapsed node.
[SfTreeGrid.ItemsSourceChanged](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.TreeGrid.SfTreeGrid.html) event occurs when the data source is changed by using [ItemsSource](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.TreeGrid.SfTreeGrid.html#Syncfusion_UI_Xaml_TreeGrid_SfTreeGrid_ItemsSource) property.
484
+
[SfTreeGrid.ItemsSourceChanged](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.TreeGrid.SfTreeGrid.html#Syncfusion_UI_Xaml_TreeGrid_SfTreeGrid_ItemsSourceChanged) event occurs when the data source is changed by using [ItemsSource](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.TreeGrid.SfTreeGrid.html#Syncfusion_UI_Xaml_TreeGrid_SfTreeGrid_ItemsSource) property.
483
485
484
486
This event receives two arguments namely sender that handles SfTreeGrid and `GridItemsSourceChangedEventArgs` as objects.
485
487
The `GridItemsSourceChangedEventArgs` object contains the following properties:
@@ -509,7 +511,7 @@ This event is raised when the DataModel property value is changed, if the DataMo
509
511
510
512
`PropertyChangedEventArgs` has below property,
511
513
512
-
`PropertyName` – It denotes the PropertyName of the changed value.
514
+
*`PropertyName` – It denotes the PropertyName of the changed value.
513
515
514
516
#### NodeCollectionChanged
515
517
@@ -553,7 +555,7 @@ using (treeGrid.View.DeferRefresh(TreeViewRefreshMode.NodeRefresh))
553
555
554
556
**BeginInit and EndInit**
555
557
556
-
When <code>BeginInit</code> method is called, it suspends all the updates until <code>EndInit</code> method is called. You can perform all the update with in these methods and update the view at once. You can refresh the nodes or completely recreates the nodes by using [TreeViewRefreshMode](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.TreeGrid.TreeViewRefreshMode.html) parameter.
558
+
When <code>BeginInit</code> method is called, it suspends all the updates until <code>EndInit</code> method is called. You can perform all the update with in these methods and update the view at once. You can refresh the nodes or completely recreates the nodes by using [TreeViewRefreshMode](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.TreeGrid.TreeViewRefreshMode.html) parameter.
0 commit comments