The Syncfusion native Blazor components library offers 70+ UI and Data Viz web controls that are responsive and lightweight for building modern web apps.
.NET PDF framework is a high-performance and comprehensive library used to create, read, merge, split, secure, edit, view, and review PDF files in C#/VB.NET.
Hi all,
I try to enhance the CellDragButton example. I want to insert different numbers of buttons in some cells. I tried to override the Draw method in the renderer but the buttons are always added. i want to clear the button collection, but i find no possibilty. What do i make wrong.
Thanks for your help.
Best regards
Kai.
ADAdministrator Syncfusion Team November 7, 2003 08:06 AM UTC
In the CellButton sample, the number of buttons is used both in the CellModel class where it sets the BarSize and the CellRenderer class in the constructor where its creates and adds the buttons.
And any buttons that have been added using renderer.AddButtons will be drawn when the base class ondraw is called. So, if you do not want to see them, you have to remove them using renderer.RemoveButton before you call the base class draw. But the problem is dynamically changing these particular cellmodel/cellrenderer properties as the grid needs each cell (say to draw) will be involved.
I think the simplest way to do this would be to create new CellModel/CellRenderer objects to handle differing numbers of buttons. You can change the sample code to pass the number of buttons in the model constructor and renderer constructor, and use that value to crate a varying number of buttons. Then use grid.CellModels.Add to add a different celltype for each number of button cells you need.
gridControl1.CellModels.Add("Ellip1", new MyEllipsisCellModel(gridControl1.Model, 1));
gridControl1.CellModels.Add("Ellip2", new MyEllipsisCellModel(gridControl1.Model, 2));
gridControl1.CellModels.Add("Ellip4", new MyEllipsisCellModel(gridControl1.Model, 4));
Then you would set the CellType of any of your button cells to which of the "EllipX" is needed for the particular cell. And this could be done dynamcially if needed.