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)
0 commit comments