A Microsoft platform for building and publishing apps for Windows devices.
Hi,
Welcome to Microsoft Q&A!
You could use RenderAsync(UIElement, Int32, Int32) method to specify values for scaledWidth and scaledHeight to alter the original source's rendering dimension. As for actual size of container, you could use FrameworkElement.ActualWidth and FrameworkElement.ActualHeight property to get (such as mygrid.ActualWidth).
What you need to know is if scaledWidth and scaledHeight are both set, the aspect ratio of the original bitmap is ignored, and your values can alter the aspect ratio. More info could be found in this part about scaledWidth and scaledHeight values of this official document.
If the response is helpful, please click "Accept Answer" and upvote it.
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.