I try to paint in my WPF PDF viewer.
If no PDF is loaded, this works.
When i opened a file, the painted things are not longer visible.
public class PDFView : PDFViewWPF{ // ...
#region Drawing
protected override void OnRender(DrawingContext drawingContext) { Trace.WriteLine("PDFView: OnRender");
base.OnRender(drawingContext);
drawingContext.DrawRectangle(Brushes.Red, new Pen(Brushes.Black, 0), new System.Windows.Rect(150, 150, 100, 100)); }
#endregion Drawing
// ... }
The answer is given by Chales Petzold here. His answer is 'don't know why', however a comment correctly suggests that setting the window's Background to transparent fixes the bug. It is possible that Grid generates this problem. Default Window contains a Grid element. |