Skip to content

Commit 7e9ede5

Browse files
committed
Provided UG for DataGridHyperlinkColumn
1 parent a5cb947 commit 7e9ede5

File tree

1 file changed

+64
-0
lines changed

1 file changed

+64
-0
lines changed

MAUI/DataGrid/Column-types.md

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1418,6 +1418,70 @@ The `DataGridNumericColumn` allows formatting the numeric data with culture-spec
14181418

14191419
* `NullValue` - To set the null value when the numeric cell value is null, use the [DataGridNumericColumn.NullValue](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.DataGrid.DataGridNumericColumn.html#Syncfusion_Maui_DataGrid_DataGridNumericColumn_NullValue) property.
14201420

1421+
## DataGridHyperlinkColumn
1422+
1423+
The `DataGridHyperlinkColumn` inherits all the properties of the `DataGridTextColumn`. It displays column data as clickable hyperlinks. It renders link text in each record cell and lets end users invoke navigation.
1424+
1425+
{% tabs %}
1426+
{% highlight xaml %}
1427+
<syncfusion:SfDataGrid x:Name="dataGrid"
1428+
AutoGenerateColumnsMode="None"
1429+
ItemsSource="{Binding OrderInfoCollection}">
1430+
<syncfusion:SfDataGrid.Columns>
1431+
<syncfusion:DataGridHyperlinkColumn HeaderText="Country Link"
1432+
MappingName="Country"
1433+
/>
1434+
</syncfusion:SfDataGrid.Columns>
1435+
</syncfusion:SfDataGrid>
1436+
1437+
{% endhighlight %}
1438+
1439+
{% highlight c# %}
1440+
DataGridHyperlinkColumn hyperlinkColumn = new DataGridHyperlinkColumn()
1441+
{
1442+
MappingName = "Country",
1443+
HeaderText = "CountryLink",
1444+
};
1445+
dataGrid.Columns.Add(hyperlinkColumn);
1446+
1447+
{% endhighlight %}
1448+
1449+
{% endtabs %}
1450+
1451+
You can allow end-user to navigate the Uri when the cell value contains valid Uri address or using `DataGridCurrentCellRequestNavigatingEventArgs ` event. The `CurrentCellRequestNavigating` occurs when the current cell in DataGridHyperlinkColumn is clicked for navigation.
1452+
1453+
`DataGridCurrentCellRequestNavigatingEventArgs` of `CurrentCellRequestNavigating` event provide information about the hyperlink triggered this event. DataGridCurrentCellRequestNavigatingEventArgs.NavigateText returns the value from the column’s DisplayBinding if it is defined; otherwise, it uses the value bound to MappingName.
1454+
1455+
{% tabs %}
1456+
{% highlight C# %}
1457+
1458+
dataGrid.CurrentCellRequestNavigating += dataGrid_CurrentCellRequestNavigating;
1459+
1460+
private void dataGrid_CurrentCellRequestNavigating(object sender, DataGridCurrentCellRequestNavigatingEventArgs e)
1461+
{
1462+
string address = "https://en.wikipedia.org/wiki/" + e.NavigateText;
1463+
Launcher.OpenAsync(new Uri(address));
1464+
}
1465+
1466+
{% endhighlight %}
1467+
{% endtabs %}
1468+
1469+
1470+
## Cancel the navigation
1471+
You can cancel the navigation by setting DataGridCurrentCellRequestNavigatingEventArgs.Cancel to true.
1472+
1473+
{% tabs %}
1474+
{% highlight C# %}
1475+
dataGrid.CurrentCellRequestNavigating += dataGrid_CurrentCellRequestNavigating;
1476+
1477+
private void dataGrid_CurrentCellRequestNavigating(object sender, DataGridCurrentCellRequestNavigatingEventArgs e)
1478+
{
1479+
e.Cancel = true;
1480+
}
1481+
1482+
{% endhighlight %}
1483+
{% endtabs %}
1484+
14211485
## Row header
14221486

14231487
The row header is a type of column that is placed as the first cell of each row and remains frozen. To enable the row header, set [SfDataGrid.ShowRowHeader](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.DataGrid.SfDataGrid.html#Syncfusion_Maui_DataGrid_SfDataGrid_ShowRowHeader) to `true` Additionally, the `SfDataGrid` allows you to customize the row header width using the [SfDataGrid.RowHeaderWidth](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.DataGrid.SfDataGrid.html#Syncfusion_Maui_DataGrid_SfDataGrid_RowHeaderWidth) property. The default value is `30.`

0 commit comments

Comments
 (0)