Hi,
I noticed that when overriding the System.Windows.Window OnRender method fails to draw to the screen. I'm sure there's a good reason for this but was unable to find the explanation.
The following code demonstrates this:
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
namespace WpfApplication1
{
public partial class Window1 : Window
{
Pen pen = new Pen();
public Window1()
{
InitializeComponent();
pen.Brush = Brushes.Black;
}
protected override void OnRender(DrawingContext dc)
{
base.OnRender(dc);
dc.DrawRectangle(Brushes.Black, pen, new Rect(0, 0, 600, 400));
dc.DrawEllipse(Brushes.Green, pen, new Point(300, 300), 50, 50);
}
}
}
replacing the drawing logic in a FrameworkElement (then setting the element as the content of a window) work fine.
thanks,
Danny