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.
Dear Syncfusion,
We are working with Syncfusion 3.2.1.0 GridGroupingControl.
In some cells, we want to display text as left/center aligned and image(icon) as right aligned.
We are handling _QueryCellStyleInfo event with the below given code.
e.Style.BackgroundImageMode = GridBackgroundImageMode.Normal;
e.Style.BackgroundImage = Image///loaded from library
e.Style.Text = cellText;
e.Style.TextAlign = GridTextAlign.Left;
But we see the image also left aligned and text starting after image..We could not find Right aligning option for image..
Can you please help?
Rgds
Rajani Kanth Badri
ADAdministrator Syncfusion Team June 28, 2006 04:13 PM UTC
Hi Rajani,
To draw the Image with Right align in a textbox cell, You need to handle the TableControlDrawCell event. Here is a code snippet.
if(e.Inner.RowIndex > 0 && e.Inner.ColIndex == 2)
{
Point pt = new Point(e.Inner.Bounds.X + e.Inner.Bounds.Width - img.Size.Width , e.Inner.Bounds.Y );
Rectangle RightRect = new Rectangle( pt,img.Size);
e.Inner.Renderer.Draw(e.Inner.Graphics,e.Inner.Bounds,e.Inner.RowIndex,e.Inner.ColIndex,e.Inner.Style);
e.Inner.Graphics.DrawImage(img,RightRect);
e.Inner.Cancel = true;
}
}
Here is a sample.
http://www.syncfusion.com/Support/user/uploads/ImageTextBoxwithAlignment_626e184f.zip
Let me know if this helps.
Best Regards,
Haneef