I have a UserControl which overrides the OnRender-Method as follow:
MyUsercontrol.cs:
MyUserControl: UserControl
{
protected override void OnRender(DrawingContext dc)
{
dc.DrawRectangle(Brushes.White, new Pen(Brushes.Black,1), new Rect(0,10,50,30));
var visualBrush = new VisualBrush(new UserControl1{Height=30, Width=50});
dc.DrawGeometry(visualBrush, null, new RectangleGeometry(new Rect(50,10,50,30)));
}
}
The UserControl used above looks like this (defined in xaml, without additional codebehind code):
<UserControl x:Class="VisualBrushExample.UserControl1" ...>
<Grid>
<Border BorderThickness="1" BorderBrush="Black" Background="White" CornerRadius=8,0,0,8"/>
</Grid>
</UserControl>
Now if I use MyUserControl I get following output:
My question now is, if there exists a way how I can use UserControl1 in the OnRender() method without get this transparent border around the UserControl1-Rectangle.
Thanks in advance, rhe1980