diff --git a/wpf/Release-notes/v30.2.5.md b/wpf/Release-notes/v30.2.5.md new file mode 100644 index 000000000..2b62b0bd1 --- /dev/null +++ b/wpf/Release-notes/v30.2.5.md @@ -0,0 +1,60 @@ +--- +title: Essential Studio for WPF Weekly Nuget Release Release Notes +description: Essential Studio for WPF Weekly Nuget Release Release Notes +platform: WPF +documentation: ug +--- + +# Essential Studio for WPF Release Notes + +{% include release-info.html date="August 13, 2025" version="v30.2.5" passed="179294" failed="0" %} + +{% directory path: _includes/release-notes/v30.2.5 %} + +{% include {{file.url}} %} + +{% enddirectory %} + +## Test Results + +| Component Name | Test Cases | Passed | Failed | Remarks | +|---------------|------------|--------|--------|---------| +| CheckListBox | 150 | 150 | 0 | All Passed | +| ChromelessWindow | 152 | 152 | 0 | All Passed | +| ColorPicker | 114 | 114 | 0 | All Passed | +| ColorPickerPalette | 104 | 104 | 0 | All Passed | +| ComboBoxAdv | 118 | 118 | 0 | All Passed | +| DateTimeEdit | 169 | 169 | 0 | All Passed | +| DockingManager | 1084 | 1084 | 0 | All Passed | +| DoubleTextBox | 345 | 345 | 0 | All Passed | +| EditControl | 193 | 193 | 0 | All Passed | +| FastLineChart | 191 | 191 | 0 | All Passed | +| GanttControl | 1732 | 1732 | 0 | All Passed | +| GridDataControl | 519 | 519 | 0 | All Passed | +| PdfViewer | 2998 | 2998 | 0 | All Passed | +| PivotGrid | 104 | 104 | 0 | All Passed | +| PropertyGrid | 143 | 143 | 0 | All Passed | +| Ribbon | 2017 | 2017 | 0 | All Passed | +| SfBulletGraph | 147 | 147 | 0 | All Passed | +| SfChart | 1309 | 1309 | 0 | All Passed | +| SfCirculargauge | 305 | 305 | 0 | All Passed | +| SfDataGrid | 4704 | 4704 | 0 | All Passed | +| SfDatePicker | 118 | 118 | 0 | All Passed | +| SfImageEditor | 177 | 177 | 0 | All Passed | +| SfMaskedEdit | 104 | 104 | 0 | All Passed | +| SfMultiColumnDropDownControl | 188 | 188 | 0 | All Passed | +| SfScheduler | 4815 | 4815 | 0 | All Passed | +| SfSpreadsheet | 2511 | 2511 | 0 | All Passed | +| SfTextInputLayout | 333 | 333 | 0 | All Passed | +| SfTimePicker | 125 | 125 | 0 | All Passed | +| SfTreeGrid | 2165 | 2165 | 0 | All Passed | +| SfTreeMap | 742 | 742 | 0 | All Passed | +| SfTreeView | 1211 | 1211 | 0 | All Passed | +| TabControlExt | 130 | 130 | 0 | All Passed | +| TileViewControl | 131 | 131 | 0 | All Passed | +| TreeViewAdv | 284 | 284 | 0 | All Passed | +| UpDown | 295 | 295 | 0 | All Passed | +| DocIO | 39822 | 39822 | 0 | All Passed | +| PDF | 14453 | 14453 | 0 | All Passed | +| Presentation | 50985 | 50985 | 0 | All Passed | +| XlsIO | 44107 | 44107 | 0 | All Passed | \ No newline at end of file diff --git a/wpf/Release-notes/v30.2.6.md b/wpf/Release-notes/v30.2.6.md new file mode 100644 index 000000000..6aa54fe06 --- /dev/null +++ b/wpf/Release-notes/v30.2.6.md @@ -0,0 +1,60 @@ +--- +title: Essential Studio for WPF Weekly Nuget Release Release Notes +description: Essential Studio for WPF Weekly Nuget Release Release Notes +platform: WPF +documentation: ug +--- + +# Essential Studio for WPF Release Notes + +{% include release-info.html date="August 19, 2025" version="v30.2.6" passed="179294" failed="0" %} + +{% directory path: _includes/release-notes/v30.2.6 %} + +{% include {{file.url}} %} + +{% enddirectory %} + +## Test Results + +| Component Name | Test Cases | Passed | Failed | Remarks | +|---------------|------------|--------|--------|---------| +| CheckListBox | 150 | 150 | 0 | All Passed | +| ChromelessWindow | 152 | 152 | 0 | All Passed | +| ColorPicker | 114 | 114 | 0 | All Passed | +| ColorPickerPalette | 104 | 104 | 0 | All Passed | +| ComboBoxAdv | 118 | 118 | 0 | All Passed | +| DateTimeEdit | 169 | 169 | 0 | All Passed | +| DockingManager | 1084 | 1084 | 0 | All Passed | +| DoubleTextBox | 345 | 345 | 0 | All Passed | +| EditControl | 193 | 193 | 0 | All Passed | +| FastLineChart | 191 | 191 | 0 | All Passed | +| GanttControl | 1732 | 1732 | 0 | All Passed | +| GridDataControl | 519 | 519 | 0 | All Passed | +| PdfViewer | 2998 | 2998 | 0 | All Passed | +| PivotGrid | 104 | 104 | 0 | All Passed | +| PropertyGrid | 143 | 143 | 0 | All Passed | +| Ribbon | 2017 | 2017 | 0 | All Passed | +| SfBulletGraph | 147 | 147 | 0 | All Passed | +| SfChart | 1309 | 1309 | 0 | All Passed | +| SfCirculargauge | 305 | 305 | 0 | All Passed | +| SfDataGrid | 4704 | 4704 | 0 | All Passed | +| SfDatePicker | 118 | 118 | 0 | All Passed | +| SfImageEditor | 177 | 177 | 0 | All Passed | +| SfMaskedEdit | 104 | 104 | 0 | All Passed | +| SfMultiColumnDropDownControl | 188 | 188 | 0 | All Passed | +| SfScheduler | 4815 | 4815 | 0 | All Passed | +| SfSpreadsheet | 2511 | 2511 | 0 | All Passed | +| SfTextInputLayout | 333 | 333 | 0 | All Passed | +| SfTimePicker | 125 | 125 | 0 | All Passed | +| SfTreeGrid | 2165 | 2165 | 0 | All Passed | +| SfTreeMap | 742 | 742 | 0 | All Passed | +| SfTreeView | 1211 | 1211 | 0 | All Passed | +| TabControlExt | 130 | 130 | 0 | All Passed | +| TileViewControl | 131 | 131 | 0 | All Passed | +| TreeViewAdv | 284 | 284 | 0 | All Passed | +| UpDown | 295 | 295 | 0 | All Passed | +| DocIO | 39822 | 39822 | 0 | All Passed | +| PDF | 14453 | 14453 | 0 | All Passed | +| Presentation | 50985 | 50985 | 0 | All Passed | +| XlsIO | 44107 | 44107 | 0 | All Passed | \ No newline at end of file diff --git a/wpf/Release-notes/v30.2.7.md b/wpf/Release-notes/v30.2.7.md new file mode 100644 index 000000000..ab7be7ad8 --- /dev/null +++ b/wpf/Release-notes/v30.2.7.md @@ -0,0 +1,16 @@ +--- +title: Essential Studio for WPF Weekly Nuget Release Release Notes +description: Essential Studio for WPF Weekly Nuget Release Release Notes +platform: WPF +documentation: ug +--- + +# Essential Studio for WPF Release Notes + +{% include release-info.html date="August 26, 2025" version="v30.2.7" %} + +{% directory path: _includes/release-notes/v30.2.7 %} + +{% include {{file.url}} %} + +{% enddirectory %} \ No newline at end of file diff --git a/wpf/TreeGrid/Clipboard-Operations.md b/wpf/TreeGrid/Clipboard-Operations.md index db70269f6..68279119a 100644 --- a/wpf/TreeGrid/Clipboard-Operations.md +++ b/wpf/TreeGrid/Clipboard-Operations.md @@ -32,14 +32,14 @@ You can use the IncludeHeaders, IncludeFormat, and IncludeHiddenColumn options a {% tabs %} {% highlight xaml %} + AutoExpandMode="RootNodesExpanded" + AutoGenerateColumns="False" + GridCopyOption="CopyData,IncludeHeaders" + ChildPropertyName="Children" + ColumnSizer="Star" + ExpanderColumn="FirstName" + ItemsSource="{Binding PersonDetails}" + NavigationMode="Row"> {% endhighlight %} {% highlight c# %} diff --git a/wpf/TreeGrid/Column-Sizing.md b/wpf/TreeGrid/Column-Sizing.md index 7cbb31cce..018208ef9 100644 --- a/wpf/TreeGrid/Column-Sizing.md +++ b/wpf/TreeGrid/Column-Sizing.md @@ -43,6 +43,7 @@ Calculates the width of column based on header and cell contents. So that header FillColumn + 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. @@ -50,8 +51,9 @@ While setting the `TreeGrid.ColumnSizer` property, all column widths are calcula AutoFillColumn -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. + +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. @@ -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. @@ -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# %} @@ -172,7 +174,7 @@ public class TreeGridColumnSizerExt:TreeGridColumnSizer ### Auto width calculation based on font settings -By default, the ColumnSizer calculates column's width based on fixed `FontSize`, `FontFamily`, `Margin`,`SortIconWidth`. You can change the calculation by customized settings. +By default, the ColumnSizer calculates column's width based on fixed `FontSize`, `FontFamily`, `Margin`, `SortIconWidth`. You can change the calculation by customized settings. #### Changing SortIcon width @@ -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); @@ -219,6 +221,7 @@ public static class StarRatio public static readonly DependencyProperty ColumnRatioProperty = DependencyProperty.RegisterAttached("ColumnRatio", typeof(int), typeof(StarRatio), new PropertyMetadata(1, null)); } + {% endhighlight %} {% endtabs %} @@ -226,12 +229,12 @@ 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) { } @@ -267,7 +270,6 @@ public class TreeGridColumnSizerExt : TreeGridColumnSizer foreach (var remColumn in removedColumn) { - if (!columns.Contains(remColumn)) { removedWidth += remColumn.ActualWidth; @@ -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; @@ -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 %} diff --git a/wpf/TreeGrid/Columns.md b/wpf/TreeGrid/Columns.md index e14811867..02d030c05 100644 --- a/wpf/TreeGrid/Columns.md +++ b/wpf/TreeGrid/Columns.md @@ -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# %} @@ -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; } @@ -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" }; } @@ -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; @@ -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; @@ -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# %} @@ -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 %} @@ -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. @@ -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# %} @@ -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 %} diff --git a/wpf/TreeGrid/Data-Binding.md b/wpf/TreeGrid/Data-Binding.md index 6eea36154..607db9033 100644 --- a/wpf/TreeGrid/Data-Binding.md +++ b/wpf/TreeGrid/Data-Binding.md @@ -10,14 +10,14 @@ documentation: ug # Data Binding in WPF TreeGrid (SfTreeGrid) 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). -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. +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. Below are the ways to bind the data source to SfTreeGrid. * [Populate data using self-relational binding](https://help.syncfusion.com/wpf/treegrid/getting-started#binding-self-relational-data-in-sftreegrid) * [Populate data using nested collection](https://help.syncfusion.com/wpf/treegrid/getting-started#binding-nested-collection-with-sftreegrid) -* [Populate data with `RequestTreeItems` event](https://help.syncfusion.com/wpf/treegrid/load-on-demand#using-requesttreeitems-event) -* [Populate data with `LoadOnDemandCommand`](https://help.syncfusion.com/wpf/treegrid/load-on-demand#using-loadondemandcommand) +* [Populate data with RequestTreeItems event](https://help.syncfusion.com/wpf/treegrid/load-on-demand#using-requesttreeitems-event) +* [Populate data with LoadOnDemandCommand](https://help.syncfusion.com/wpf/treegrid/load-on-demand#using-loadondemandcommand) ## Binding with IEnumerable @@ -269,14 +269,15 @@ You can cancel the specific node being expanded by using `SfTreeGrid.NodeExpandi {% tabs %} {% highlight c# %} + treeGrid.NodeExpanding += TreeGrid_NodeExpanding; private void TreeGrid_NodeExpanding(object sender, NodeExpandingEventArgs e) { - if ((e.Node.Item as EmployeeInfo).ID == 2) e.Cancel = true; } + {% endhighlight %} {% endtabs %} @@ -412,20 +413,21 @@ You can cancel the specific node being collapsed by using `TreeGrid.NodeCollapsi {% tabs %} {% highlight c# %} + treeGrid.NodeCollapsing += TreeGrid_NodeCollapsing; private void TreeGrid_NodeCollapsing(object sender, NodeCollapsingEventArgs e) { - if ((e.Node.Item as EmployeeInfo).ID == 2) e.Cancel = true; } + {% endhighlight %} {% endtabs %} ### NodeCollapsed Event -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. +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. {% tabs %} {% highlight c# %} @@ -479,7 +481,7 @@ treeGrid.LiveNodeUpdateMode = LiveNodeUpdateMode.AllowDataShaping; ### ItemsSourceChanged -[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. +[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. This event receives two arguments namely sender that handles SfTreeGrid and `GridItemsSourceChangedEventArgs` as objects. 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 `PropertyChangedEventArgs` has below property, -`PropertyName` – It denotes the PropertyName of the changed value. +* `PropertyName` – It denotes the PropertyName of the changed value. #### NodeCollectionChanged @@ -553,7 +555,7 @@ using (treeGrid.View.DeferRefresh(TreeViewRefreshMode.NodeRefresh)) **BeginInit and EndInit** -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. +When BeginInit method is called, it suspends all the updates until EndInit 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. {% tabs %} {% highlight c# %} diff --git a/wpf/TreeGrid/Editing.md b/wpf/TreeGrid/Editing.md index b6de18cf0..3d783fc42 100644 --- a/wpf/TreeGrid/Editing.md +++ b/wpf/TreeGrid/Editing.md @@ -9,7 +9,7 @@ documentation: ug # Editing in WPF TreeGrid (SfTreeGrid) -SfTreeGrid provides support for editing and it can be enabled or disabled by setting [SfTreeGrid.AllowEditing]() property. +SfTreeGrid provides support for editing and it can be enabled or disabled by setting [SfTreeGrid.AllowEditing](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.Grid.SfGridBase.html#Syncfusion_UI_Xaml_Grid_SfGridBase_AllowEditing) property. {% tabs %} {% highlight xaml %} @@ -50,9 +50,9 @@ N> `TreeGridColumn.AllowEditing` takes higher priority than `SfTreeGrid.AllowEdi N> It is mandatory to set the NavigationMode to Cell to enable CurrentCell navigation and editing. -### Entering into edit mode +## Entering into edit mode -You can enter into edit mode by pressing <kbd>F2</kbd> key or clicking (touch also supported) the cell. You can allow users to edit the cell in single click (OnTap) or double click (OnDoubleTab) by setting [SfTreeGrid.EditTrigger](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.Grid.SfGridBase.html#Syncfusion_UI_Xaml_Grid_SfGridBase_EditTrigger) property. +You can enter into edit mode by pressing F2 key or clicking (touch also supported) the cell. You can allow users to edit the cell in single click (OnTap) or double click (OnDoubleTab) by setting [SfTreeGrid.EditTrigger](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.Grid.SfGridBase.html#Syncfusion_UI_Xaml_Grid_SfGridBase_EditTrigger) property. {% tabs %} {% highlight xaml %} @@ -73,7 +73,7 @@ this.treeGrid.EditTrigger = EditTrigger.OnTap; {% endhighlight %} {% endtabs %} -### Cursor placement +## Cursor placement When the cell enters into edit mode, cursor is placed based on [SfTreeGrid.EditorSelectionBehavior](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.Grid.SfGridBase.html#Syncfusion_UI_Xaml_Grid_SfGridBase_EditorSelectionBehavior) property. @@ -105,13 +105,13 @@ this.treeGrid.EditorSelectionBehavior = EditorSelectionBehavior.SelectAll; SfTreeGrid supports to commit and roll back the changes in row level when underlying data object implements [IEditableObject](https://learn.microsoft.com/en-us/dotnet/api/system.componentmodel.ieditableobject?redirectedfrom=MSDN&view=net-5.0) interface. -The editing changes in a row will be committed only when user move to next row or pressing enter key in [EndEdit](https://learn.microsoft.com/en-us/dotnet/api/system.componentmodel.ieditableobject.endedit?redirectedfrom=MSDN&view=net-5.0#System_ComponentModel_IEditableObject_EndEdit). Also when user press <kbd> Esc </kbd> key, then the changes made in a row will be reverted in [CancelEdit](https://learn.microsoft.com/en-us/dotnet/api/system.componentmodel.ieditableobject.canceledit?redirectedfrom=MSDN&view=net-5.0#System_ComponentModel_IEditableObject_CancelEdit). +The editing changes in a row will be committed only when user move to next row or pressing enter key in [EndEdit](https://learn.microsoft.com/en-us/dotnet/api/system.componentmodel.ieditableobject.endedit?redirectedfrom=MSDN&view=net-5.0#System_ComponentModel_IEditableObject_EndEdit). Also when user press Esc key, then the changes made in a row will be reverted in [CancelEdit](https://learn.microsoft.com/en-us/dotnet/api/system.componentmodel.ieditableobject.canceledit?redirectedfrom=MSDN&view=net-5.0#System_ComponentModel_IEditableObject_CancelEdit). `IEditableObject` has the following methods to capture editing, [BeginEdit](https://learn.microsoft.com/en-us/dotnet/api/system.componentmodel.ieditableobject.beginedit?redirectedfrom=MSDN&view=net-5.0#System_ComponentModel_IEditableObject_BeginEdit) - Gets called to begin edit on underlying data object when cell in a row get into edit mode. -[CancelEdit](https://learn.microsoft.com/en-us/dotnet/api/system.componentmodel.ieditableobject.canceledit?redirectedfrom=MSDN&view=net-5.0#System_ComponentModel_IEditableObject_CancelEdit) - Gets called when user press the <kbd>Esc</kbd> key to discard the changes in a row since last `BeginEdit` call. +[CancelEdit](https://learn.microsoft.com/en-us/dotnet/api/system.componentmodel.ieditableobject.canceledit?redirectedfrom=MSDN&view=net-5.0#System_ComponentModel_IEditableObject_CancelEdit) - Gets called when user press the Esc key to discard the changes in a row since last `BeginEdit` call. [EndEdit](https://learn.microsoft.com/en-us/dotnet/api/system.componentmodel.ieditableobject.endedit?redirectedfrom=MSDN&view=net-5.0#System_ComponentModel_IEditableObject_EndEdit) - Gets called when user move to the next row or press Enter key to commit changes in underlying data object since last `BeginEdit` call. @@ -127,7 +127,6 @@ public class EmployeeInfo : IEditableObject, INotifyPropertyChanged /// Gets or sets the ID. /// /// The ID. - public int ID { get @@ -146,7 +145,6 @@ public class EmployeeInfo : IEditableObject, INotifyPropertyChanged /// Gets or sets the first name. /// /// The first name. - public string FirstName { get { return _firstName; } @@ -162,7 +160,6 @@ public class EmployeeInfo : IEditableObject, INotifyPropertyChanged /// Gets or sets the last name. /// /// The last name. - public string LastName { get { return _lastName; } @@ -178,7 +175,6 @@ public class EmployeeInfo : IEditableObject, INotifyPropertyChanged /// Gets or sets the title. /// /// The title. - public string Title { get @@ -197,7 +193,6 @@ public class EmployeeInfo : IEditableObject, INotifyPropertyChanged /// Gets or sets the salary. /// /// The salary. - public double? Salary { get @@ -216,7 +211,6 @@ public class EmployeeInfo : IEditableObject, INotifyPropertyChanged /// Gets or sets the reports to. /// /// The reports to. - public int ReportsTo { get @@ -237,7 +231,6 @@ public class EmployeeInfo : IEditableObject, INotifyPropertyChanged foreach (var pDescriptor in itemProperties) { - if (pDescriptor.CanWrite) dictionary.Add(pDescriptor.Name, pDescriptor.GetValue(this)); } @@ -253,7 +246,6 @@ public class EmployeeInfo : IEditableObject, INotifyPropertyChanged public void CancelEdit() { - if (this.storedValues == null) return; @@ -269,7 +261,6 @@ public class EmployeeInfo : IEditableObject, INotifyPropertyChanged public void EndEdit() { - if (this.storedValues != null) { this.storedValues.Clear(); @@ -281,7 +272,6 @@ public class EmployeeInfo : IEditableObject, INotifyPropertyChanged public void RaisePropertyChanged(string propertyName) { - if (PropertyChanged != null) PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); } @@ -296,7 +286,7 @@ SfTreeGrid triggers the following events during editing. ### CurrentCellBeginEdit Event -[CurrentCellBeginEdit](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.TreeGrid.SfTreeGrid.html) event occurs when the [CurrentCell](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.TreeGrid.TreeGridCurrentCellManager.html#Syncfusion_UI_Xaml_TreeGrid_TreeGridCurrentCellManager_CurrentCell) enter into edit mode. [TreeCurrentCellBeginEditEventArgs](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.TreeGrid.TreeGridCurrentCellBeginEditEventArgs.html) has following members which provides information for `CurrentCellBeginEdit` event. +[CurrentCellBeginEdit](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.TreeGrid.SfTreeGrid.html#Syncfusion_UI_Xaml_TreeGrid_SfTreeGrid_CurrentCellBeginEdit) event occurs when the [CurrentCell](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.TreeGrid.TreeGridCurrentCellManager.html#Syncfusion_UI_Xaml_TreeGrid_TreeGridCurrentCellManager_CurrentCell) enter into edit mode. [TreeCurrentCellBeginEditEventArgs](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.TreeGrid.TreeGridCurrentCellBeginEditEventArgs.html) has following members which provides information for `CurrentCellBeginEdit` event. * [Cancel](https://learn.microsoft.com/en-us/dotnet/api/system.componentmodel.canceleventargs.cancel?redirectedfrom=MSDN&view=net-5.0#System_ComponentModel_CancelEventArgs_Cancel) : When set to `true`, the event is canceled and the `CurrentCell` does not enter into the edit mode. @@ -318,8 +308,8 @@ void TreeGrid_CurrentCellBeginEdit(object sender, TreeGridCurrentCellBeginEditEv ### CurrentCellEndEdit Event -[CurrentCellEndEdit](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.TreeGrid.SfTreeGrid.html) event occurs when the [CurrentCell](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.TreeGrid.TreeGridCurrentCellManager.html#Syncfusion_UI_Xaml_TreeGrid_TreeGridCurrentCellManager_CurrentCell) exits the edit mode. -[CurrentCellEndEditEventArgs]() has following members which provides information for `CurrentCellEndEdit` event. +[CurrentCellEndEdit](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.TreeGrid.SfTreeGrid.html#Syncfusion_UI_Xaml_TreeGrid_SfTreeGrid_CurrentCellEndEdit) event occurs when the [CurrentCell](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.TreeGrid.TreeGridCurrentCellManager.html#Syncfusion_UI_Xaml_TreeGrid_TreeGridCurrentCellManager_CurrentCell) exits the edit mode. +[CurrentCellEndEditEventArgs](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.Grid.CurrentCellEndEditEventArgs.html) has following members which provides information for `CurrentCellEndEdit` event. * RowColumnIndex : Gets the value for the current row column index. @@ -337,7 +327,7 @@ void TreeGrid_CurrentCellEndEdit(object sender, CurrentCellEndEditEventArgs args ### CurrentCellValueChanged Event -[CurrentCellValueChanged](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.TreeGrid.SfTreeGrid.html) event occurs whenever a value changes in TreeGridColumn that supports editing. +[CurrentCellValueChanged](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.TreeGrid.SfTreeGrid.html#Syncfusion_UI_Xaml_TreeGrid_SfTreeGrid_CurrentCellValueChanged) event occurs whenever a value changes in TreeGridColumn that supports editing. [TreeGridCurrentCellValueChangedEventArgs](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.TreeGrid.TreeGridCurrentCellValueChangedEventArgs.html) has following members which provides information for `CurrentCellValueChanged` event. * [Column](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.TreeGrid.TreeGridCurrentCellValueChangedEventArgs.html#Syncfusion_UI_Xaml_TreeGrid_TreeGridCurrentCellValueChangedEventArgs_Column) : Gets the Grid Column of the SfTreeGrid. @@ -359,7 +349,7 @@ N> For TreeGridComboBoxColumn, you have to use the 'CurrentCellDropDownSelection ### CurrentCellDropDownSelectionChanged Event -[CurrentCellDropDownSelectionChanged](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.TreeGrid.SfTreeGrid.html) event occurs whenever the `SelectedItem` of `TreeGridComboBoxColumn` column changed. +[CurrentCellDropDownSelectionChanged](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.TreeGrid.SfTreeGrid.html#Syncfusion_UI_Xaml_TreeGrid_SfTreeGrid_CurrentCellDropDownSelectionChanged) event occurs whenever the `SelectedItem` of `TreeGridComboBoxColumn` column changed. [CurrentCellDropDownSelectionChangedEventArgs](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.Grid.CurrentCellDropDownSelectionChangedEventArgs.html) has following members which provides information for `CurrentCellDropDownSelectionChanged` event. * [RowColumnIndex](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.Grid.CurrentCellDropDownSelectionChangedEventArgs.html#Syncfusion_UI_Xaml_Grid_CurrentCellDropDownSelectionChangedEventArgs_RowColumnIndex) - Gets the RowColumnIndex of the corresponding item that were selected from the drop-down control. @@ -382,7 +372,7 @@ void TreeGrid_CurrentCellDropDownSelectionChanged(object sender, CurrentCellDrop ### BeginEdit -SfTreeGrid allows you to edit the cell programmatically by calling the [BeginEdit](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.TreeGrid.TreeGridCurrentCellManager.html#Syncfusion_UI_Xaml_TreeGrid_TreeGridCurrentCellManager_BeginEdit) method. Initially the[CurrentCell](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.TreeGrid.TreeGridCurrentCellManager.html#Syncfusion_UI_Xaml_TreeGrid_TreeGridCurrentCellManager_CurrentCell) need to set before calling the `BeginEdit` method when the CurrentCell value is null. +SfTreeGrid allows you to edit the cell programmatically by calling the [BeginEdit](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.TreeGrid.TreeGridCurrentCellManager.html#Syncfusion_UI_Xaml_TreeGrid_TreeGridCurrentCellManager_BeginEdit) method. Initially the [CurrentCell](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.TreeGrid.TreeGridCurrentCellManager.html#Syncfusion_UI_Xaml_TreeGrid_TreeGridCurrentCellManager_CurrentCell) need to set before calling the `BeginEdit` method when the CurrentCell value is null. {% tabs %} {% highlight c# %} @@ -420,7 +410,7 @@ void TreeGrid_Loaded(object sender, RoutedEventArgs e) ### CancelEdit -You can use the [CurrentCellBeginEdit](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.TreeGrid.SfTreeGrid.html) event to cancel the editing operation for the corresponding cell. +You can use the [CurrentCellBeginEdit](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.TreeGrid.SfTreeGrid.html#Syncfusion_UI_Xaml_TreeGrid_SfTreeGrid_CurrentCellBeginEdit) event to cancel the editing operation for the corresponding cell. {% tabs %} {% highlight c# %} diff --git a/wpf/TreeGrid/Filtering.md b/wpf/TreeGrid/Filtering.md index e05667ec5..6235f5c22 100644 --- a/wpf/TreeGrid/Filtering.md +++ b/wpf/TreeGrid/Filtering.md @@ -106,7 +106,7 @@ You can find whether a particular node has child node(s) displayed in a view (ma {% tabs %} {% highlight c# %} -var treeNode=treeGrid.View.Nodes[0]; +var treeNode = treeGrid.View.Nodes[0]; var hasVisibleChildNodes = treeNode.HasVisibleChildNodes; {% endhighlight %} @@ -402,9 +402,6 @@ By default, filters are applied to the columns when OK button is clicked in UI f ImmediateUpdateColumnFilter="True"/> {% endhighlight %} -{% endtabs %} - -{% tabs %} {% highlight c# %} this.sfTreeGrid.Columns["EmployeeID"].ImmediateUpdateColumnFilter = true; @@ -434,9 +431,6 @@ To filter the null values, the [TreeGridColumn.AllowBlankFilters](https://help.s {% endhighlight %} -{% endtabs %} - -{% tabs %} {% highlight c# %} this.sfTreeGrid.Columns["FirstName"].AllowBlankFilters = true; @@ -454,7 +448,7 @@ The following screenshot illustrates advanced filter when `AllowBlankFilters` is ## Changing AdvancedFilter type when loading dynamic ItemsSource -By default, the text filters will be loaded for the columns if `ItemsSource` is [dynamic](https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/reference-types). The [TreeGridColumn.ColumnMemberType](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.TreeGrid.TreeGridColumn.html#Syncfusion_UI_Xaml_TreeGrid_TreeGridColumn_ColumnMemberType) property loads number filters or date filters based on the column values. +By default, the text filters will be loaded for the columns if `ItemsSource` is [dynamic](https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/reference-types#the-dynamic-type). The [TreeGridColumn.ColumnMemberType](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.TreeGrid.TreeGridColumn.html#Syncfusion_UI_Xaml_TreeGrid_TreeGridColumn_ColumnMemberType) property loads number filters or date filters based on the column values. {% tabs %} {% highlight c# %} @@ -468,7 +462,7 @@ this.sfTreeGrid.Columns["EmployeeID"].ColumnMemberType = typeof(double); ### Loading text filter for number or date column -The [SfTreeGrid.FilterItemsPopulating](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.TreeGrid.SfTreeGrid.html) event is used to load text filters for the columns that have number or date value as underlying type by setting value of the `TreeGridFilterItemsPopulatingEventArgs.FilterControl.AdvancedFilterType` property to `AdvancedFilterType.TextFilter`. +The [SfTreeGrid.FilterItemsPopulating](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.TreeGrid.SfTreeGrid.html#Syncfusion_UI_Xaml_TreeGrid_SfTreeGrid_FilterItemsPopulating) event is used to load text filters for the columns that have number or date value as underlying type by setting value of the `TreeGridFilterItemsPopulatingEventArgs.FilterControl.AdvancedFilterType` property to `AdvancedFilterType.TextFilter`. {% tabs %} {% highlight c# %} @@ -476,17 +470,17 @@ The [SfTreeGrid.FilterItemsPopulating](https://help.syncfusion.com/cr/wpf/Syncfu this.sfTreeGrid.FilterItemsPopulating += OnSfTreeGridFilterItemsPopulating; private void OnSfTreeGridFilterItemsPopulating(object sender, TreeGridFilterItemsPopulatingEventArgs e) - { - if (e.Column.MappingName == "EmployeeID") - e.FilterControl.AdvancedFilterType = AdvancedFilterType.TextFilter; - } +{ + if (e.Column.MappingName == "EmployeeID") + e.FilterControl.AdvancedFilterType = AdvancedFilterType.TextFilter; +} {% endhighlight %} {% endtabs %} ### Customizing filter predicates -The filter predicates can be customized using the [SfTreeGrid.FilterChanging](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.TreeGrid.SfTreeGrid.html) event. This event occurs when applying filter using the filter control. Here, [FilterValue](https://help.syncfusion.com/cr/wpf/Syncfusion.Data.FilterPredicate.html#Syncfusion_Data_FilterPredicate_FilterValue) is changed based on some conditions. +The filter predicates can be customized using the [SfTreeGrid.FilterChanging](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.TreeGrid.SfTreeGrid.html#Syncfusion_UI_Xaml_TreeGrid_SfTreeGrid_FilterChanging) event. This event occurs when applying filter using the filter control. Here, [FilterValue](https://help.syncfusion.com/cr/wpf/Syncfusion.Data.FilterPredicate.html#Syncfusion_Data_FilterPredicate_FilterValue) is changed based on some conditions. {% tabs %} {% highlight c# %} @@ -507,7 +501,7 @@ private void OnSfTreeGridFilterChanging(object sender, TreeGridFilterChangingEve ### Customizing Excel-like filter ItemsSource -The [TreeGridFilterControl](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.TreeGrid.Filtering.TreeGridFilterControl.html) `ItemsSource` can be customized to restrict some data from filtering using the [SfTreeGrid.FilterItemsPopulated](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.TreeGrid.SfTreeGrid.html) event. Here, the [FilterElement](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.Grid.FilterElement.html) that has actual value as 0 is removed from `ItemsSource`. +The [TreeGridFilterControl](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.TreeGrid.Filtering.TreeGridFilterControl.html) `ItemsSource` can be customized to restrict some data from filtering using the [SfTreeGrid.FilterItemsPopulated](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.TreeGrid.SfTreeGrid.html#Syncfusion_UI_Xaml_TreeGrid_SfTreeGrid_FilterItemsPopulated) event. Here, the [FilterElement](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.Grid.FilterElement.html) that has actual value as 0 is removed from `ItemsSource`. {% tabs %} {% highlight c# %} @@ -533,7 +527,7 @@ private void OnSfTreeGridFilterItemsPopulated(object sender, TreeGridFilterItems ### Changing filter UI -Filter UI can be changed either for all the columns or for a specific column in SfTreeGrid by changing the [FilterMode](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.TreeGrid.Filtering.TreeGridFilterControl.html#Syncfusion_UI_Xaml_TreeGrid_Filtering_TreeGridFilterControl_FilterMode) property value using the [SfTreeGrid.FilterItemsPopulating](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.TreeGrid.SfTreeGrid.html) event. +Filter UI can be changed either for all the columns or for a specific column in SfTreeGrid by changing the [FilterMode](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.TreeGrid.Filtering.TreeGridFilterControl.html#Syncfusion_UI_Xaml_TreeGrid_Filtering_TreeGridFilterControl_FilterMode) property value using the [SfTreeGrid.FilterItemsPopulating](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.TreeGrid.SfTreeGrid.html#Syncfusion_UI_Xaml_TreeGrid_SfTreeGrid_FilterItemsPopulating) event. Here, filter UI is changed to `AdvancedFilter` only for `EmployeeID` column. @@ -553,7 +547,7 @@ private void SfTreeGrid_FilterItemsPopulating(object sender, TreeGridFilterItems ### Customizing sort options text -Sort options text can be customized by changing the value of [AscendingSortString](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.TreeGrid.Filtering.TreeGridFilterControl.html#Syncfusion_UI_Xaml_TreeGrid_Filtering_TreeGridFilterControl_AscendingSortString) and [DescendingSortString](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.TreeGrid.Filtering.TreeGridFilterControl.html#Syncfusion_UI_Xaml_TreeGrid_Filtering_TreeGridFilterControl_DescendingSortString) properties in the [TreeGridFilterControl](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.TreeGrid.Filtering.TreeGridFilterControl.html) using the [SfTreeGrid.FilterItemsPopulating](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.TreeGrid.SfTreeGrid.html) event. +Sort options text can be customized by changing the value of [AscendingSortString](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.TreeGrid.Filtering.TreeGridFilterControl.html#Syncfusion_UI_Xaml_TreeGrid_Filtering_TreeGridFilterControl_AscendingSortString) and [DescendingSortString](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.TreeGrid.Filtering.TreeGridFilterControl.html#Syncfusion_UI_Xaml_TreeGrid_Filtering_TreeGridFilterControl_DescendingSortString) properties in the [TreeGridFilterControl](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.TreeGrid.Filtering.TreeGridFilterControl.html) using the [SfTreeGrid.FilterItemsPopulating](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.TreeGrid.SfTreeGrid.html#Syncfusion_UI_Xaml_TreeGrid_SfTreeGrid_FilterItemsPopulating) event. {% tabs %} {% highlight c# %} diff --git a/wpf/TreeGrid/Getting-Started.md b/wpf/TreeGrid/Getting-Started.md index 93ef75c6b..bc4d954e8 100644 --- a/wpf/TreeGrid/Getting-Started.md +++ b/wpf/TreeGrid/Getting-Started.md @@ -37,7 +37,7 @@ Syncfusion.Data.WPF assembly is dependent assembly for Syncfusion.SfGrid. WPF Syncfusion.SfGrid.WPF -Syncfusion.SfGrid. WPF assembly contains classes that handles all UI operations of SfTreeGrid. +Syncfusion.SfGrid.WPF assembly contains classes that handles all UI operations of SfTreeGrid. SfTreeGrid control present in Syncfusion.UI.Xaml.TreeGrid namespace. This namespace also added in http://schemas.syncfusion.com/wpf Syncfusion WPF schema. @@ -104,6 +104,7 @@ In this walk through, you will create WPF application with SfTreeGrid control. 9. [Selection](#selection) 10. [Sorting](#sorting) 11. [Editing](#editing) +12. [Filtering](#filtering) #### Creating the project @@ -611,7 +612,7 @@ Property of type Uri -When columns are auto-generated, you can handle the [SfTreeGrid.AutoGeneratingColumn](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.TreeGrid.SfTreeGrid.html) event to customize or cancel the columns before they are added to the SfTreeGrid. +When columns are auto-generated, you can handle the [SfTreeGrid.AutoGeneratingColumn](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.TreeGrid.SfTreeGrid.html#Syncfusion_UI_Xaml_TreeGrid_SfTreeGrid_AutoGeneratingColumn) event to customize or cancel the columns before they are added to the SfTreeGrid. You can prevent the automatic column generation by setting [SfTreeGrid.AutoGenerateColumns](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.Grid.SfGridBase.html#Syncfusion_UI_Xaml_Grid_SfGridBase_AutoGenerateColumns) property to false. When `SfTreeGrid.AutoGenerateColumns` property is false, you should define the columns to be displayed as below, {% tabs %} @@ -729,20 +730,20 @@ Represents SfTreeGrid column that hosts template-specified content in its cells ### Selection By default, the entire row is selected when a user clicks a cell in a SfTreeGrid. You can set the [SfTreeGrid.SelectionMode](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.Grid.SfGridBase.html#Syncfusion_UI_Xaml_Grid_SfGridBase_SelectionMode) property to specify whether a user can select single row or cell, or multiple rows or cells. -You can handle the selection operations with the help of [SfTreeGrid.SelectionChanging](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.TreeGrid.SfTreeGrid.html) and [SfTreeGrid.SelectionChanged](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.TreeGrid.SfTreeGrid.html) events. +You can handle the selection operations with the help of [SfTreeGrid.SelectionChanging](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.TreeGrid.SfTreeGrid.html#Syncfusion_UI_Xaml_TreeGrid_SfTreeGrid_SelectionChanging) and [SfTreeGrid.SelectionChanged](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.TreeGrid.SfTreeGrid.html#Syncfusion_UI_Xaml_TreeGrid_SfTreeGrid_SelectionChanged) events. ### Sorting By default, you can sort columns in a SfTreeGrid by clicking the column header. You can configure the sorting by setting [SfTreeGrid.SortColumnDescriptions](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.Grid.SfGridBase.html#Syncfusion_UI_Xaml_Grid_SfGridBase_SortColumnDescriptions) property. -You can customize sorting by handling the [SfTreeGrid.SortColumnChanging](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.TreeGrid.SfTreeGrid.html) and [SfTreeGrid.SortColumnChanged](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.TreeGrid.SfTreeGrid.html) events. To cancel the default sort, set the Cancel property to true in `SfTreeGrid.SortColumnChanging` event. +You can customize sorting by handling the [SfTreeGrid.SortColumnsChanging](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.TreeGrid.SfTreeGrid.html#Syncfusion_UI_Xaml_TreeGrid_SfTreeGrid_SortColumnsChanging) and [SfTreeGrid.SortColumnsChanged](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.TreeGrid.SfTreeGrid.html#Syncfusion_UI_Xaml_TreeGrid_SfTreeGrid_SortColumnsChanged) events. To cancel the default sort, set the Cancel property to true in `SfTreeGrid.SortColumnsChanging` event. ### Editing -Editing can be enabled by setting [SfTreeGrid.AllowEditing](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.Grid.SfGridBase.html#Syncfusion_UI_Xaml_Grid_SfGridBase_AllowEditing) property to True. You can customize the editing operations by handling [SfTreeGrid.CurrentCellBeginEdit](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.TreeGrid.SfTreeGrid.html) and [SfTreeGrid.CurrentCellEndEdit](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.TreeGrid.SfTreeGrid.html) events. +Editing can be enabled by setting [SfTreeGrid.AllowEditing](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.Grid.SfGridBase.html#Syncfusion_UI_Xaml_Grid_SfGridBase_AllowEditing) property to True. You can customize the editing operations by handling [SfTreeGrid.CurrentCellBeginEdit](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.TreeGrid.SfTreeGrid.html#Syncfusion_UI_Xaml_TreeGrid_SfTreeGrid_CurrentCellBeginEdit) and [SfTreeGrid.CurrentCellEndEdit](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.TreeGrid.SfTreeGrid.html#Syncfusion_UI_Xaml_TreeGrid_SfTreeGrid_CurrentCellEndEdit) events. ### Filtering -Filtering can be enabled by setting the [SfTreeGrid.AllowFiltering](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.TreeGrid.SfTreeGrid.html#Syncfusion_UI_Xaml_TreeGrid_SfTreeGrid_AllowFiltering) property to true, where advanced filter UI can be opened by clicking the filter icon in column header to filter the nodes in SfTreeGrid. The filtering operations can be customized by handling the [SfTreeGrid.FilterChanging](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.TreeGrid.SfTreeGrid.html) and [SfTreeGrid.FilterChanged](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.TreeGrid.SfTreeGrid.html) events. +Filtering can be enabled by setting the [SfTreeGrid.AllowFiltering](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.TreeGrid.SfTreeGrid.html#Syncfusion_UI_Xaml_TreeGrid_SfTreeGrid_AllowFiltering) property to true, where advanced filter UI can be opened by clicking the filter icon in column header to filter the nodes in SfTreeGrid. The filtering operations can be customized by handling the [SfTreeGrid.FilterChanging](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.TreeGrid.SfTreeGrid.html#Syncfusion_UI_Xaml_TreeGrid_SfTreeGrid_FilterChanging) and [SfTreeGrid.FilterChanged](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.TreeGrid.SfTreeGrid.html#Syncfusion_UI_Xaml_TreeGrid_SfTreeGrid_FilterChanged) events. ![WPF TreeGrid with Filtering](Getting-Started_images/wpf-treegrid-filter.png) diff --git a/wpf/TreeGrid/Selection.md b/wpf/TreeGrid/Selection.md index fdd893bab..fee00f5cf 100644 --- a/wpf/TreeGrid/Selection.md +++ b/wpf/TreeGrid/Selection.md @@ -22,15 +22,14 @@ The [SelectionMode](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.Grid.S {% tabs %} {% highlight xaml %} + AutoExpandMode="RootNodesExpanded" + AutoGenerateColumns="False" + NavigationMode="Row" + ChildPropertyName="Children" + SelectionMode="Single" + ColumnSizer="Star" + ExpanderColumn="FirstName" + ItemsSource="{Binding PersonDetails}"> {% endhighlight %} {% endtabs %} @@ -38,7 +37,7 @@ The [SelectionMode](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.Grid.S ## Disable selection for rows and columns -You can disable selection and navigation on particular column by setting the [GridColumn.AllowFocus](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.Grid.GridColumnBase.html#Syncfusion_UI_Xaml_Grid_GridColumnBase_AllowFocus) property. You can disable selection on particular row or column by handling the [CurrentCellActivating](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.TreeGrid.SfTreeGrid.html) event. +You can disable selection and navigation on particular column by setting the [GridColumn.AllowFocus](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.Grid.GridColumnBase.html#Syncfusion_UI_Xaml_Grid_GridColumnBase_AllowFocus) property. You can disable selection on particular row or column by handling the [CurrentCellActivating](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.TreeGrid.SfTreeGrid.html#Syncfusion_UI_Xaml_TreeGrid_SfTreeGrid_CurrentCellActivating) event. ## Multiple row selection @@ -49,15 +48,14 @@ When using Extended, you can select multiple rows by pressing the key modifiers {% tabs %} {% highlight xaml %} + AutoExpandMode="RootNodesExpanded" + AutoGenerateColumns="False" + NavigationMode="Row" + ChildPropertyName="Children" + SelectionMode="Extended" + ColumnSizer="Star" + ExpanderColumn="FirstName" + ItemsSource="{Binding PersonDetails}"> {% endhighlight %} {% endtabs %} @@ -88,13 +86,13 @@ Both [SelectedItem](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.Grid.S You can select a single row by setting the [SelectedItem](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.Grid.SfGridBase.html#Syncfusion_UI_Xaml_Grid_SfGridBase_SelectedItem) property or [SelectedIndex](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.Grid.SfGridBase.html#Syncfusion_UI_Xaml_Grid_SfGridBase_SelectedIndex) property. {% tabs %} -{% highlight c# %} +{% highlight c# tabtitle="C# [SelectedIndex]" %} var recordIndex = this.treeGrid.ResolveToNodeIndex(6); this.treeGrid.SelectedIndex = recordIndex; {% endhighlight %} -{% highlight c# %} +{% highlight c# tabtitle="C# [SelectedItem]" %} var node = this.treeGrid.GetNodeAtRowIndex(6); this.treeGrid.SelectedItem = node.Item; @@ -110,7 +108,7 @@ var viewModel = this.treeGrid.DataContext as ViewModel; foreach (var order in viewModel.PersonDetails) { - if (order.LastName == "Buchanan") + if (order.LastName == "Buchanan") this.treeGrid.SelectedItems.Add(order); } {% endhighlight %} @@ -363,7 +361,7 @@ Commits only the changes when the current cell is in edit mode and retains the f -If the {{'[TreeGrid](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.Grid.SfGridBase.html#Syncfusion_UI_Xaml_Grid_SfGridBase_AllowEditing)'| markdownify }} property is true, and the +If the {{'[SfTreeGrid.AllowEditing](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.Grid.SfGridBase.html#Syncfusion_UI_Xaml_Grid_SfGridBase_AllowEditing)'| markdownify }} property is true, and the {{'[GridColumn.AllowEditing](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.Grid.GridColumnBase.html#Syncfusion_UI_Xaml_Grid_GridColumnBase_AllowEditing)'| markdownify }} property is true for the current column, the current cell enters into edit mode. @@ -486,7 +484,7 @@ You can customize the mouse and keyboard behaviors by overriding the selection c ### CurrentCellActivating -[ActivationTrigger](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.Grid.SfGridBase.html#Syncfusion_UI_Xaml_Grid_SfGridBase_AllowEditing): Returns the reason for moving the current cell. +[ActivationTrigger](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.CellGrid.Helpers.CurrentCellActivatingEventArgs.html#Syncfusion_UI_Xaml_CellGrid_Helpers_CurrentCellActivatingEventArgs_ActivationTrigger): Returns the reason for moving the current cell. [CurrentRowColumnIndex](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.Grid.CurrentCellActivatingEventArgs.html#Syncfusion_UI_Xaml_Grid_CurrentCellActivatingEventArgs_CurrentRowColumnIndex): [RowColumnIndex](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.ScrollAxis.RowColumnIndex.html) of the cell where the current cell need to move. @@ -516,7 +514,7 @@ private void TreeGrid_CurrentCellActivating(object sender, Syncfusion.UI.Xaml.Gr {% endhighlight %} {% endtabs %} -You can cancel the current cell moving process within this event by setting [GridCurrentCellActivatingEventArgs.Cancel](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.TreeGrid.SfTreeGrid.html) to true. +You can cancel the current cell moving process within this event by setting [GridCurrentCellActivatingEventArgs.Cancel](https://help.syncfusion.com/cr/wpf/Syncfusion.Windows.ComponentModel.SyncfusionCancelRoutedEventArgs.html#Syncfusion_Windows_ComponentModel_SyncfusionCancelRoutedEventArgs_Cancel) to true. {% tabs %} {% highlight c# %} @@ -573,7 +571,7 @@ private void TreeGrid_CurrentCellActivated(object sender, Syncfusion.UI.Xaml.Gri ### SelectionChanging -The [SelectionChanging](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.Grid.CurrentCellActivatedEventArgs.html#Syncfusion_UI_Xaml_Grid_CurrentCellActivatedEventArgs_PreviousRowColumnIndex) event occurs before processing the selection to a particular row or cell. This event is triggered only to the keyboard and mouse interactions. [GridSelectionChangingEventArgs](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.Grid.GridSelectionChangingEventArgs.html) has the following members, which provide information to the SelectionChanging event. +The [SelectionChanging](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.TreeGrid.SfTreeGrid.html#Syncfusion_UI_Xaml_TreeGrid_SfTreeGrid_SelectionChanging) event occurs before processing the selection to a particular row or cell. This event is triggered only to the keyboard and mouse interactions. [GridSelectionChangingEventArgs](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.Grid.GridSelectionChangingEventArgs.html) has the following members, which provide information to the SelectionChanging event. [AddedItems](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.Grid.GridSelectionChangingEventArgs.html#Syncfusion_UI_Xaml_Grid_GridSelectionChangingEventArgs_AddedItems): Collection of [GridRowInfo](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.Grid.GridRowInfo.html) or [GridCellInfo](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.Grid.GridCellInfo.html) where the selection is going to be processed. @@ -645,16 +643,15 @@ You can change the selection background and foreground using the [SelectionBackG {% tabs %} {% highlight xaml %} + Grid.Row="0" + AutoExpandMode="RootNodesExpanded" + AutoGenerateColumns="False" + SelectionMode="Multiple" + ChildPropertyName="ReportsTo" + SelectionChanged="TreeGrid_SelectionChanged" + ItemsSource="{Binding EmployeeInfo}" + SelectionBackground="SkyBlue" + SelectionForeground="DarkBlue"> {% endhighlight %} {% endtabs %} @@ -667,19 +664,18 @@ You can change the current cell border thickness and border color using the [Cur {% tabs %} {% highlight xaml %} + Grid.Row="0" + AutoExpandMode="RootNodesExpanded" + AutoGenerateColumns="False" + SelectionMode="Multiple" + ChildPropertyName="ReportsTo" + SelectionChanged="TreeGrid_SelectionChanged" + ItemsSource="{Binding EmployeeInfo}" + LiveNodeUpdateMode="AllowDataShaping" + ParentPropertyName="ID" + SelectedIndex="0" + CurrentCellBorderBrush="Red" + CurrentCellBorderThickness="1.6"> {% endhighlight %} {% endtabs %} @@ -776,14 +772,13 @@ You can customize the row selection by editing the control template of TreeGridR ## Customize selection behaviors The tree grid processes the selection operations in selection controller. [GridSelectionController](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.TreeGrid.SfTreeGrid.html#Syncfusion_UI_Xaml_TreeGrid_SfTreeGrid_SelectionController) processes selection operations when selection unit is row. -You can customize the default row selection behaviors by overriding the GridSelectionController class and set it to SfTreeGrid.SelectionController. +You can customize the default row selection behaviors by overriding the `GridSelectionController` class and set it to `SfTreeGrid.SelectionController`. {% tabs %} {% highlight c# %} this.treeGrid.SelectionController = new GridSelectionControllerExt(this.treeGrid); public class GridSelectionControllerExt : TreeGridRowSelectionController { - public GridSelectionControllerExt(SfTreeGrid treeGrid) : base(treeGrid) { } @@ -808,7 +803,6 @@ public class GridSelectionControllerExt : TreeGridRowSelectionController { if (args.Key == Key.Enter) { - //Creates new KeyEventArgs to refer the Tab key. KeyEventArgs arguments = new KeyEventArgs(args.KeyboardDevice, args.InputSource, args.Timestamp, Key.Tab) { RoutedEvent = args.RoutedEvent }; @@ -921,7 +915,7 @@ You can download the [sample](https://github.com/SyncfusionExamples/how-to-chang ### Select the rows based on cell value -In tree grid, you can select the rows based on cell value by adding the corresponding records to SelectedItems. You can get the cell value of a particular cell using the View.GetPropertyAccess provider method. +In tree grid, you can select the rows based on cell value by adding the corresponding records to SelectedItems. You can get the cell value of a particular cell using the `View.GetPropertyAccessProvider` method. {% tabs %} {% highlight c# %} @@ -1026,7 +1020,7 @@ private void Button_Click(object sender, RoutedEventArgs e) ### Show the selection of row/cell when setting the background -The `Row`/`Cell` selection border is behind the grid cell content. So, when you apply the background for a row, the selection is not displayed in `UI`. You can overcome this by setting opacity in TreeGridCell. +The `Row`/`Cell` selection border is behind the grid cell content. So, when you apply the background for a row, the selection is not displayed in `UI`. You can overcome this by setting opacity in `TreeGridCell`. {% tabs %} {% highlight xaml %} diff --git a/wpf/TreeGrid/Sorting.md b/wpf/TreeGrid/Sorting.md index 2c8728865..15c305924 100644 --- a/wpf/TreeGrid/Sorting.md +++ b/wpf/TreeGrid/Sorting.md @@ -97,8 +97,8 @@ Following are the sequence of sorting orders when clicking column header, ## Multi column sorting -SfTreeGrid control allows you sort more than one column, where sorting is applied one column against other columns. To apply sorting on multiple columns, user have to click the column header by pressing the <kbd>Ctrl</kbd> key. -In the below screen shot, the `First Name` column sorted. Then the `Employee ID` column is sorted against the `First Name` data by clicking column header by pressing <kbd>Ctrl</kbd> key. The sorting state of `First Name` column is preserved and `Employee ID` column sorted against `First Name` column. +SfTreeGrid control allows you sort more than one column, where sorting is applied one column against other columns. To apply sorting on multiple columns, user have to click the column header by pressing the Ctrl key. +In the below screen shot, the `First Name` column sorted. Then the `Employee ID` column is sorted against the `First Name` data by clicking column header by pressing Ctrl key. The sorting state of `First Name` column is preserved and `Employee ID` column sorted against `First Name` column. ![Multi Column Sorting in WPF TreeGrid](Sorting_images/wpf-treegrid-multi-column-sorting.png) @@ -128,7 +128,7 @@ this.treeGrid.ShowSortNumbers = true; ## Programmatic Sorting -You can sort the data programmatically by adding or removing the SortColumnDescription in [SfTreeGrid.SortColumnDescriptions](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.Grid.SortColumnDescription.html) property. +You can sort the data programmatically by adding or removing the [SortColumnDescription](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.Grid.SortColumnDescription.html) in [SfTreeGrid.SortColumnDescriptions](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.Grid.SfGridBase.html#Syncfusion_UI_Xaml_Grid_SfGridBase_SortColumnDescriptions) property. N> [SfTreeGrid.SortColumnChanging](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.TreeGrid.SfTreeGrid.html#Syncfusion_UI_Xaml_TreeGrid_SfTreeGrid_SortColumnsChanging) and [SfTreeGrid.SortColumnChanged](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.TreeGrid.SfTreeGrid.html#Syncfusion_UI_Xaml_TreeGrid_SfTreeGrid_SortColumnsChanged) events are not raised when the data sorted programmatically through `SfTreeGrid.SortColumnDescriptions`. @@ -159,7 +159,7 @@ this.treeGrid.SortColumnDescriptions.Add(new SortColumnDescription() { ColumnNam ### Removing sort columns -You can unsort the data by removing the corresponding `SortColumnDescription` from the [SfTreeGrid.SortColumnDescriptions](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.Grid.SortColumnDescription.html) property. +You can unsort the data by removing the corresponding [SortColumnDescription](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.Grid.SortColumnDescription.html) from the [SfTreeGrid.SortColumnDescriptions](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.Grid.SfGridBase.html#Syncfusion_UI_Xaml_Grid_SfGridBase_SortColumnDescriptions) property. {% tabs %} {% highlight c# %} @@ -174,7 +174,7 @@ if (sortColumnDescription != null) ### Clear sorting -You can clear sorting, by clearing the [SfTreeGrid.SortColumnDescriptions](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.Grid.SortColumnDescription.html). +You can clear sorting, by clearing the [SfTreeGrid.SortColumnDescriptions](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.Grid.SfGridBase.html#Syncfusion_UI_Xaml_Grid_SfGridBase_SortColumnDescriptions). {% tabs %} {% highlight c# %} @@ -186,8 +186,7 @@ this.treeGrid.SortColumnDescriptions.Clear(); ## Custom sorting -SfTreeGrid allows you to sort the columns based on the custom logic. -The custom sorting can be applied by adding the [SortComparer](https://help.syncfusion.com/cr/wpf/Syncfusion.Data.SortComparer.html) instance to [SfTreeGrid.SortComparers](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.TreeGrid.SfTreeGrid.html#Syncfusion_UI_Xaml_TreeGrid_SfTreeGrid_SortComparers). +SfTreeGrid allows you to sort the columns based on the custom logic. The custom sorting can be applied by adding the [SortComparer](https://help.syncfusion.com/cr/wpf/Syncfusion.Data.SortComparer.html) instance to [SfTreeGrid.SortComparers](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.TreeGrid.SfTreeGrid.html#Syncfusion_UI_Xaml_TreeGrid_SfTreeGrid_SortComparers). The [SortComparer](https://help.syncfusion.com/cr/wpf/Syncfusion.Data.SortComparer.html) have the following properties, @@ -208,7 +207,6 @@ In the below code snippet, `FirstName` property is compared based on its string public class CustomSortComparer : IComparer, ISortDirection { - public int Compare(object x, object y) { var item1 = x as EmployeeInfo; @@ -221,12 +219,10 @@ public class CustomSortComparer : IComparer, ISortDirection { c = 1; } - else if (value1 == null && value2 != null) { c = -1; } - else if (value1 != null && value2 != null) { c = value1.Length.CompareTo(value2.Length); @@ -251,7 +247,7 @@ public class CustomSortComparer : IComparer, ISortDirection {% endhighlight %} {% endtabs %} -####Adding custom comparer to SfTreeGrid +#### Adding custom comparer to SfTreeGrid Custom comparer can be added to [SfTreeGrid.SortComparers](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.TreeGrid.SfTreeGrid.html#Syncfusion_UI_Xaml_TreeGrid_SfTreeGrid_SortComparers) property. `SortComparers` maintains custom comparers and the custom comparer gets called when corresponding column gets sorted by clicking column header or programmatically. @@ -272,15 +268,15 @@ this.treeGrid.SortComparers.Add(new SortComparer() { Comparer = new CustomSortCo {% endhighlight %} {% endtabs %} -Sorting `FirstName` column sorts the data using custom sort comparer available in `SfTreeGrid.SortComparers`. +Sorting `First Name` column sorts the data using custom sort comparer available in `SfTreeGrid.SortComparers`. ![WPF TreeGrid with Custom Sorting](Sorting_images/wpf-treegrid-custom-sorting.png) ## Handling events -### SortColumnChanging event +### SortColumnsChanging event -[SfTreeGrid.SortColumnChanging](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.TreeGrid.SfTreeGrid.html#Syncfusion_UI_Xaml_TreeGrid_SfTreeGrid_SortColumnsChanging) event occurs while sorting the columns by clicking column header. [GridSortColumnsChangingEventArgs](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.Grid.GridSortColumnsChangingEventArgs.html) has following members which provides information for `SortColumnChanging` event. +[SfTreeGrid.SortColumnsChanging](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.TreeGrid.SfTreeGrid.html#Syncfusion_UI_Xaml_TreeGrid_SfTreeGrid_SortColumnsChanging) event occurs while sorting the columns by clicking column header. [GridSortColumnsChangingEventArgs](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.Grid.GridSortColumnsChangingEventArgs.html) has following members which provides information for `SortColumnsChanging` event. [Action](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.Grid.GridSortColumnsChangingEventArgs.html#Syncfusion_UI_Xaml_Grid_GridSortColumnsChangingEventArgs_Action) - Gets the action triggered this event. @@ -292,7 +288,7 @@ Sorting `FirstName` column sorts the data using custom sort comparer available i [CancelScroll](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.Grid.GridSortColumnsChangingEventArgs.html#Syncfusion_UI_Xaml_Grid_GridSortColumnsChangingEventArgs_CancelScroll) - Gets or sets a value that indicates, whether scroll and bring SelectedItem in view after sorting takes place. -You can prevent sorting for the particular column through [GridSortColumnsChangingEventArgs.Cancel](https://learn.microsoft.com/en-us/dotnet/api/system.componentmodel.canceleventargs.cancel?redirectedfrom=MSDN&view=net-5.0#System_ComponentModel_CancelEventArgs_Cancel) property of `SortColumnChanging` event. +You can prevent sorting for the particular column through [GridSortColumnsChangingEventArgs.Cancel](https://learn.microsoft.com/en-us/dotnet/api/system.componentmodel.canceleventargs.cancel?redirectedfrom=MSDN&view=net-5.0#System_ComponentModel_CancelEventArgs_Cancel) property of `SortColumnsChanging` event. {% tabs %} {% highlight c# %} @@ -301,7 +297,6 @@ this.treeGrid.SortColumnsChanging += TreeGrid_SortColumnsChanging; private void TreeGrid_SortColumnsChanging(object sender, GridSortColumnsChangingEventArgs e) { - if (e.AddedItems[0].ColumnName == "FirstName") { e.Cancel = true; @@ -311,9 +306,9 @@ private void TreeGrid_SortColumnsChanging(object sender, GridSortColumnsChanging {% endhighlight %} {% endtabs %} -### SortColumnChanged event +### SortColumnsChanged event -[SfTreeGrid.SortColumnChanged](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.TreeGrid.SfTreeGrid.html#Syncfusion_UI_Xaml_TreeGrid_SfTreeGrid_SortColumnsChanged) event occurs when the sorting is applied to the column. [GridSortColumnsChangedEventArgs](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.Grid.GridSortColumnsChangedEventArgs.html) provides information for `SortColumnChanged` event. +[SfTreeGrid.SortColumnsChanged](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.TreeGrid.SfTreeGrid.html#Syncfusion_UI_Xaml_TreeGrid_SfTreeGrid_SortColumnsChanged) event occurs when the sorting is applied to the column. [GridSortColumnsChangedEventArgs](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.Grid.GridSortColumnsChangedEventArgs.html) provides information for `SortColumnsChanged` event. N> You can refer to our [WPF TreeGrid](https://www.syncfusion.com/wpf-controls/treegrid) feature tour page for its groundbreaking feature representations. You can also explore our [WPF TreeGrid example](https://github.com/syncfusion/wpf-demos) to know how to render and configure the treegrid. \ No newline at end of file