Hello,
I have a custom DataGridViewToolBarColumn. I have defined a Public Class wDataGridViewToolBarBarCell.
All work fine on No binded datagridview.
If the datagridview is binded, the toolbar control on cell is showed only on the last row.
Any suggest?
Thanks in advance
Tanks Julie for your explanation and suggests.
I chose to use the HTML approch on cell format event.
I Know to embedd .png or emoji icon whith this code:
’emoji
e.Value =”<span role=’add’ style=’cursor:pointer; margin-right:10px; font-size:20px;’>➕</span>”
‘png
e.Value =”<img src=’resources/Add_01_24.png’ role=’add’ style=’cursor:pointer; width:20px; margin-right:10px;’ />”
But if I want to use .svg icon from wisej themes i don’t know how do this.
I tried with this:
e.Value = “<svg role=’add’ class=’icon’ style=’width:20px;height:20px;fill:green;margin-right:10px;’>” &
“<use xlink:href=’#icon-error’></use>”
where ‘#icon-error’ is the thema icon,
but not work. The problem for me is how to reference to theme icon in HTML syntax.
Any suggestion?
It’s working as expected, not a bug.
When a datagridview is data bound the rows are all virtual. They get created and destroyed all the times allowing the grid to handle unlimited number of rows. There is no instance of a cell that can be used like that.
The real rows must be created.
One way is to use datagrid1.Fill(data) instead of DataSource = data.
Another way is to iterate the rows and force the creation of the real rows:
Private Sub DataGridView1_DataBindingComplete(sender As Object, e As DataGridViewBindingCompleteEventArgs) Handles DataGridView1.DataBindingComplete
For i As Integer = 0 To DataGridView1.RowCount - 1
Dim r = DataGridView1.Rows(i)
Next
End Sub
In any case, the control should be created only in Clone() not in New().
The best approach is not to use a child control. It uses a lot of memory for large data sets. Datagrids should not be used like the datarepeater. It’s better to format the cell content using html to display buttons or icons or anything else and detect the click using the Role property of the click event. In html just add role=’delete’, role=’add’ and when clicking on the html in a cell the click event will carry the role string.
Hi Frank,
I have attached an example developed with Wisej 3.5
Hi Angelo,
please provide us with a compilable test case that includes the binding that does not work for you
and we can investigate further.
Best regards
Frank
Please login first to submit.