diff --git a/controls/combobox/keyboard-support.md b/controls/combobox/keyboard-support.md index f25636851..358891caf 100644 --- a/controls/combobox/keyboard-support.md +++ b/controls/combobox/keyboard-support.md @@ -19,7 +19,7 @@ The following table lists the actions and keyboard combinations that are availab | `F4` | Shows the drop-down if it is closed. If the drop-down is opened pressing the F4 key will submit the selection and close the drop-down. | | `Up Arrow` / `Down Arrow` | If the drop-down is opened, pressing Up/Down Arrows will change the highlighted item in the drop-down list. If it is closed pressing Up/Down Arrows will change the SelectedItem.| | `Left Arrow` / `Right Arrow` | If the drop-down is opened, pressing Left/Right Arrows will change the highlighted item in the drop-down list. If it is closed pressing Left/Right Arrows will change the SelectedItem. They work only when `IsEditable` is `False`. | -| `Enter` |Takes effect only when the drop-down of the ComboBox is opened. Commits the selection and closes the drop-down. | +| `Enter` | Opens the drop-down when the control gets focused. Commits the selection and closes the drop-down. In multiple selection mode, deselects the last selection. | | `Esc` | Takes effect only when the drop-down is opened. It cancels the selection and closes the drop-down of the ComboBox.`Esc` key is not supported in MacOS when `IsEditable` is `True`. | | `Home` / `End` | Works only when `IsEditable` is `False`. When the drop-down is opened pressing the Home/End keys will change the highlighted item to the first/last item. If the drop-down is closed pressing the Home/End keys will change the selected item to the first/last item.| | `PageUp` / `PageDown` | Pressing any of these keys will open the drop-down when it is closed. If the drop-down is opened pressing PageUp/PageDown will change the highlighted item. | diff --git a/controls/datagrid/aggregates/delegate-aggregate-descriptor.md b/controls/datagrid/aggregates/delegate-aggregate-descriptor.md index 83df30d1a..bee7c3220 100644 --- a/controls/datagrid/aggregates/delegate-aggregate-descriptor.md +++ b/controls/datagrid/aggregates/delegate-aggregate-descriptor.md @@ -14,9 +14,23 @@ The `DelegateAggregateDescriptor` allows you to define property lookup logic and To set up the `DelegateAggregateDescriptor`, use the following properties: * `ValueLookup`—Defines an `IKeyLookup` instance, which retrieves the value from the underlying `ViewModel` that is used for computing the aggregated value. + * `Function`—Defines an `IAggregateFunction` instance that performs the aggregation of the values as specified by the `ValueLookup` property. + * `Format`—Defines the string format that will be applied over the aggregated value. +The `IAggregateFunction` interface exposes the following methods: + +* `GetValue()`—Gets the computed value. + +* `Accumulate(object value)`—Applies the function logic to the provided value (the provided value is the extracted value from the `ViewModel`). + +* `Merge(IAggregateFunction aggregateFunction)`—Merges this function with another one. Used when calculating Grand Totals. + +* `Update(object oldValue, object newValue)`—Updates the aggregate function by removing the contribution of an old value and adding a new value. This allows for efficient recalculation when data items are modified without recomputing the entire aggregation. + +* `Clone()`—Clones the current instance of the `IAggregateFunction`. + The following example uses the `DelegateAggregateDescriptor` and a custom implementation for a `SumIf` function which sums the values in a range that meet a certain criteria: **1.** Create a class that inherits from the `IKeyLookup` interface. It returns the values of a `Price` property declared in the business model that is of type `double`. diff --git a/controls/datagrid/images/datagrid-scrollcolumnintoview.gif b/controls/datagrid/images/datagrid-scrollcolumnintoview.gif new file mode 100644 index 000000000..0f64dc8ff Binary files /dev/null and b/controls/datagrid/images/datagrid-scrollcolumnintoview.gif differ diff --git a/controls/datagrid/images/datagrid-scrollintoview.gif b/controls/datagrid/images/datagrid-scrollintoview.gif deleted file mode 100644 index d58515dc9..000000000 Binary files a/controls/datagrid/images/datagrid-scrollintoview.gif and /dev/null differ diff --git a/controls/datagrid/images/datagrid-scrollitemintoview.gif b/controls/datagrid/images/datagrid-scrollitemintoview.gif new file mode 100644 index 000000000..f7e6ec2a9 Binary files /dev/null and b/controls/datagrid/images/datagrid-scrollitemintoview.gif differ diff --git a/controls/datagrid/scrolling.md b/controls/datagrid/scrolling.md index e347188a8..033360341 100644 --- a/controls/datagrid/scrolling.md +++ b/controls/datagrid/scrolling.md @@ -2,7 +2,7 @@ title: Scrolling page_title: .NET MAUI DataGrid Documentation - Scrolling description: "Try now the Telerik UI for .NET MAUI DataGrid programmatic scrolling with the ScrollItemIntoView method." -position: 8 +position: 11 slug: datagrid-scrolling tags: programmatic, scrolling --- @@ -13,21 +13,74 @@ The [Telerik UI for .NET MAUI DataGrid]({%slug datagrid-overview%}) has an inter >important Avoid nesting the DataGrid in a ScrollView and other controls that provide scrolling. +## Scroll to Item + For implementing programmatic scrolling to a specific item, the DataGrid exposes the `ScrollItemIntoView(object item)` method, which brings the specified data item into view. Note that `ScrollItemIntoView` works in scenarios where the DataGrid Rows are with the same height. For more details, review the article on [setting the .NET MAUI DataGrid rows]({%slug datagrid-row-height%}). The following example shows how to scroll to the last item of the DataGrid. The code executes on a button click. -```C# -private void Button_Clicked(object sender, System.EventArgs e) -{ - var item = this.vm.Clubs[this.vm.Clubs.Count - 1]; - this.grid.ScrollItemIntoView(item); -} -``` +1. Define the DataGrid in XAML: + + + +1. Define the button, which will execute the scroll-to-item action: + + + +1. Add the `telerik` namespace: + +`xmlns:telerik="http://schemas.telerik.com/2022/xaml/maui"` + +1. 1. On button click, call the `ScrollItemIntoView` method: + + + +1. Define the data model: + + + +1. Define the `ViewModel`: + + + +The following video shows the end result. + +![.NET MAUI DataGrid Programmatic Scrolling to an Item](images/datagrid-scrollitemintoview.gif) + +## Scroll to Column + +For implementing programmatic scrolling to a specific column, the DataGrid exposes the `ScrollColumnIntoView(DataGridColumn column)` method, which brings the specified column into the visible viewport. +If the column is frozen or not part of the grid, no scrolling will occur. The scrolling operation adjusts the horizontal scroll position to make the column visible while maintaining the current vertical scroll position. + +The following example shows how to scroll to the last column of the DataGrid. The code executes on a button click. + +1. Define the DataGrid in XAML: + + + +1. Define the button, which will execute the scroll-to-column action: + + + +1. Add the `telerik` namespace: + +`xmlns:telerik="http://schemas.telerik.com/2022/xaml/maui"` + +1. 1. On button click, call the `ScrollColumnIntoView` method: + + + +1. Define the data model: + + + +1. Define the `ViewModel`: + + -The following image shows the end result. +The following video shows the end result. -![.NET MAUI DataGrid Programmatic Scrolling](images/datagrid-scrollintoview.gif) +![.NET MAUI DataGrid Programmatic Scrolling to a Column](images/datagrid-scrollcolumnintoview.gif) ## Additional Resources