Hi @Saranya Karthick ,
Welcome to Microsoft Q&A!
It is recommended to use CanvasImageBrush and CanvasDrawingSession.FillRoundedRectangle to draw a RoundedRectangle Image.
CanvasDevice device = CanvasDevice.GetSharedDevice();
CanvasRenderTarget renderTarget = new CanvasRenderTarget(device, 300, 300, 96);
using (var ds = renderTarget.CreateDrawingSession())
{
ds.Clear(Colors.White);
int photoX = 5;
int photoY = 5;
int photoWidth = 193;
int photoHeight = 121;
float cornerRadius = 40;
float borderWidth = 3;
Rect imageRect = new Rect(photoX, photoY, photoWidth, photoHeight);
Rect borderRect = new Rect(imageRect.X - borderWidth / 2, imageRect.Y - borderWidth / 2, imageRect.Width + borderWidth, imageRect.Height + borderWidth);
CanvasImageBrush fillBrush;
CanvasBitmap cb = await CanvasBitmap.LoadAsync(device, new Uri("ms-appx:///Assets/Test.png"));
fillBrush = new CanvasImageBrush(device, cb);
ds.FillRoundedRectangle(imageRect, cornerRadius, cornerRadius, fillBrush);
ds.DrawRoundedRectangle(borderRect, cornerRadius, cornerRadius, Colors.Black, borderWidth);
}
Thank you.
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.