Hello guys,
I am facing an Render(Visual) problem. I am using a simple Render(on MediaElement). It was working fine. However, if I add a border on it, or do HorizontalAlignment != Left, I got my video Render shifted and the rest will be black. For example, if my MediaElement is Aligned Vertical Center in a Grid, this means my MediaElement is shifted down. When I do render, it is render from the space before it is aligned to vertical center, so, I have some black on top and partial video render at bottom of my RenderTargetBitmap.
I believe Render() method is targeting the Visual from the original spot. If my MediaElement is shifted by Alignment, the Render() method's target area didn't shift along with it.
How do I resolve this? Thank you so much.
RenderTargetBitmap rtb = new RenderTargetBitmap( |
(int)this.x_Player.ActualWidth, (int)this.x_Player.ActualHeight, |
dpi.Width, dpi.Height, PixelFormats.Pbgra32); |
rtb.Render(this.x_Player); |