Skip to content

Commit

Permalink
Merge pull request #908 from telerik/didi/hover-cell
Browse files Browse the repository at this point in the history
Add Hover cell
  • Loading branch information
didiyordanova authored Aug 7, 2024
2 parents 39f8862 + 04fd4f7 commit 0edd1c8
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 7 deletions.
3 changes: 3 additions & 0 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,9 @@ navigation:
controls/datagrid/row-details:
title: "Row Details"
position: 4
controls/datagrid/cells:
title: "Cells"
position: 5
controls/datagrid/filtering:
title: "Filtering"
position: 6
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
---
title: Cells
title: Current Cell
page_title: .NET MAUI DataGrid Documentation - Current Cell
description: "Learn how to set the behavior and style the appearance of the current cell of the Telerik UI for .NET MAUI DataGrid component."
position: 5
description: Learn how to set the behavior and style the appearance of the current cell of the Telerik UI for .NET MAUI DataGrid component.
position: 1
previous_url: /controls/datagrid/current-cell
slug: datagrid-current-cell
---

Expand All @@ -25,7 +26,7 @@ The `CurrentCellChanged` event handler receives the following parameters:

## Styling the Cell

You can also style the current DataGrid cell by using the `CurrentCellStyle` of type `DataGridBorderStyle` and applying the `BackgroundColor`, `BorderColor`, and `BorderThickness` properties.
You can style the current DataGrid cell by using the `CurrentCellStyle` property (of type `DataGridBorderStyle`) and applying the `BackgroundColor`, `BorderColor`, and `BorderThickness` properties.

## Example

Expand Down
35 changes: 35 additions & 0 deletions controls/datagrid/cells/mouse-hover-cell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
title: Mouse Hover Cell
page_title: .NET MAUI DataGrid Documentation - Hover Cell
description: Learn how to get the current hovered cell and style the appearance of the cell of the Telerik UI for .NET MAUI DataGrid component.
position: 2
slug: datagrid-mouse-hover-cell
---

# .NET MAUI DataGrid Hover Cell

The [Telerik UI for .NET MAUI DataGrid]({%slug datagrid-overview%}) provides option to get the data of the cell that the mouse is currently over. In addition, you can change the default hover style. The feature is available only on Desktop - `WinUI` and `MacCatalyst`.

## Getting the Hovered Cell

The DataGrid provides a `VisualStateService` property (of type `DataGridVisualStateService`). This property gets the service that handles visual-state related logic, such as keeping track of the element that the mouse is currently over.

The `DataGridVisualStateService` class encapsulates visual state related logic such as mouse-hovered elements within a `Telerik.Maui.Controls.RadDataGrid` instance. This class exposes the `MouseHoverCell` property (`DataGridCellInfo`) which allows you to get the cell that the mouse is currently over.

Here is an example how to get the hovered cell.

```C#
var hoveredCell = dataGrid.VisualStateService.MouseHoverCell;
```

## Styling the Cell

You can specify the style for the cells and rows when the mouse is over by using the `MouseHoverStyle` property (of type `DataGridBorderStyle`) and applying the `BackgroundColor`, `BorderColor`, and `BorderThickness` properties.

## See Also

- [Setting the .NET MAUI DataGrid Columns]({%slug datagrid-columns-overview%})
- [Grouping in the DataGrid]({%slug datagrid-grouping-overview%})
- [Using the DataGrid Commands]({%slug datagrid-aggregates%})
- [Sorting .NET MAUI DataGrid Records]({%slug datagrid-sorting-overview%})
- [Filtering .NET MAUI DataGrid Records]({%slug datagrid-filtering-overview%})
6 changes: 3 additions & 3 deletions controls/datagrid/columns/reordering.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ The [.NET MAUI DataGrid]({%slug datagrid-overview%}) exposes a reordering featur

The following properties are relted to the reordering feature:

`CanUserReorderColumns`(`bool`)—Defines whether the user can reorder the `DataGridColumns`. The default value is `true`.
`ColumnReorderIndicatorTemplate`(`DataTemplate`)—Defines the template that presents the indicator that is displayed between two columns during reordering.
`ColumnHeaderDragVisualTemplate` (`DataTemplate`)—Specifies the template that presents the drag visual of the dragged column header.
* `CanUserReorderColumns`(`bool`)—Defines whether the user can reorder the `DataGridColumns`. The default value is `true`.
* `ColumnReorderIndicatorTemplate`(`DataTemplate`)—Defines the template that presents the indicator that is displayed between two columns during reordering.
* `ColumnHeaderDragVisualTemplate` (`DataTemplate`)—Specifies the template that presents the drag visual of the dragged column header.

## Events

Expand Down

0 comments on commit 0edd1c8

Please sign in to comment.