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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion controls/combobox/keyboard-support.md
Original file line number Diff line number Diff line change
Expand Up @@ -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. |
Expand Down
14 changes: 14 additions & 0 deletions controls/datagrid/aggregates/delegate-aggregate-descriptor.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
73 changes: 63 additions & 10 deletions controls/datagrid/scrolling.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
---
Expand All @@ -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:

<snippet id ='datagrid-scrolling'/>

1. Define the button, which will execute the scroll-to-item action:

<snippet id ='button-scrolling-to-item'/>

1. Add the `telerik` namespace:

`xmlns:telerik="http://schemas.telerik.com/2022/xaml/maui"`

1. 1. On button click, call the `ScrollItemIntoView` method:

<snippet id ='datagrid-scrolltoitem'/>

1. Define the data model:

<snippet id ='datagrid-scrolling-datamodel'/>

1. Define the `ViewModel`:

<snippet id ='datagrid-scrolling-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:

<snippet id ='datagrid-scrolling'/>

1. Define the button, which will execute the scroll-to-column action:

<snippet id ='button-scrolling-to-column'/>

1. Add the `telerik` namespace:

`xmlns:telerik="http://schemas.telerik.com/2022/xaml/maui"`

1. 1. On button click, call the `ScrollColumnIntoView` method:

<snippet id ='datagrid-scrolltocolumn'/>

1. Define the data model:

<snippet id ='datagrid-scrolling-datamodel'/>

1. Define the `ViewModel`:

<snippet id ='datagrid-scrolling-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

Expand Down