Currently, RadGridView offers GridViewImageColumn. However, it would be good to offer support for SVG images out of the box.
One possible approach is to introduce a new property for the GridViewImageColumn - ImageDrawType = ImageDrawType.Svg that controls what kind of images this column will store.
Second approach is to introduce a new GridViewSvgImageColumn.
Hello,
The following KB article demonstrates a sample approach how to extend the GridViewImageColumn and display the SVG images stored as XML content inside the grid cells:
https://docs.telerik.com/devtools/winforms/knowledge-base/svg-image-column-in-gridview
Please have in mind that the complexity of the vector images and the number of records may affect the row resizing or scrolling performance.
Regards,
Dess | Tech Support Engineer, Principal
Progress Telerik
Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.
Hi,
Thank you for sharing this request. Currently, the possible solution is to handle the CellFormatting event and apply the respective SVG image to the cell element.
Sub New()
' This call is required by the designer.
InitializeComponent()
Me.RadGridView1.Columns.Add("SVG")
Dim xml As String = "<svg xmlns=""http://www.w3.org/2000/svg"" width=""16"" height=""16"" viewBox=""0 0 16 16"" >" & "<circle cx=""8"" cy=""8"" r=""8"" fill=""#00BFE8"" />" & _
"<text x=""4"" y=""13"" fill=""white"" font-family=""Consolas, Helvetica, sans-serif"" font-size=""14px"" font-weight=""bold"">i</text>" & "</svg>"
Me.RadGridView1.Rows.Add(xml)
AddHandler Me.RadGridView1.CellFormatting, AddressOf RadGridView1_CellFormatting
End Sub
Private Sub RadGridView1_CellFormatting(sender As Object, e As Telerik.WinControls.UI.CellFormattingEventArgs)
If e.Column.Name = "SVG" AndAlso e.CellElement.Value IsNot Nothing Then
e.CellElement.DrawText = False
e.CellElement.ImageDrawType = Telerik.WinControls.ImageDrawType.Svg
e.CellElement.SvgImage = RadSvgImage.FromXml(e.CellElement.Value & "")
Else
e.CellElement.ResetValue(LightVisualElement.DrawTextProperty, ValueResetFlags.Local)
e.CellElement.ResetValue(LightVisualElement.SvgImageProperty, ValueResetFlags.Local)
End If
End Sub
Regards,
Dess | Tech Support Engineer, Principal
Progress Telerik
Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.