Skip to content

Commit 2eff31d

Browse files
Merge pull request #3568 from syncfusion-content/975708
Add UG for RowMouseHover in SfDataGrid.
2 parents 67ec9ac + 8a72c13 commit 2eff31d

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

MAUI/DataGrid/styling.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -439,6 +439,37 @@ public partial class MainPage : ContentPage
439439

440440
![Changing the alternation row count in .NET MAUI DataGrid](Images/styling/maui-datagrid-Alternation-rowcount.png)
441441

442+
## Applying row hover background color
443+
444+
You can enable row hover highlighting effect by setting `AllowRowHoverHighlighting` property to `true`. The default value is `false`. Also, you can change the mouse hover background color using the `RowHoveredBackground` property of [SfDataGrid.DefaultStyle](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.DataGrid.SfDataGrid.html#Syncfusion_Maui_DataGrid_SfDataGrid_DefaultStyleProperty).
445+
446+
{% tabs %}
447+
{% highlight xaml hl_lines="5 7" %}
448+
<ContentPage xmlns:syncfusion="http://schemas.syncfusion.com/maui">
449+
<ContentPage.Content>
450+
<syncfusion:SfDataGrid x:Name="dataGrid"
451+
ItemsSource="{Binding OrderInfoCollection}"
452+
AllowRowHoverHighlighting="True">
453+
<syncfusion:SfDataGrid.DefaultStyle>
454+
<syncfusion:DataGridStyle RowHoveredBackground ="#AFD5FB"/>
455+
</syncfusion:SfDataGrid.DefaultStyle>
456+
</syncfusion:SfDataGrid>
457+
</ContentPage.Content>
458+
</ContentPage>
459+
{% endhighlight %}
460+
{% highlight c# hl_lines="6 7" %}
461+
public partial class MainPage : ContentPage
462+
{
463+
public MainPage()
464+
{
465+
InitializeComponent();
466+
this.dataGrid.AllowRowHoverHighlighting = true;
467+
this.dataGrid.DefaultStyle.RowHoveredBackground = Color.FromArgb("#AFD5FB");
468+
}
469+
}
470+
{% endhighlight %}
471+
{% endtabs %}
472+
442473
## Changing the font style
443474
You can apply the style for header and row font attributes by using SfDataGrid.DefaultStyle.
444475

0 commit comments

Comments
 (0)