Here's a very simple repro: Start up VS2010 or VS2008, new a WPF project (.Net Framework 3.5 sp1), add an empty page (Page1.xaml) to the project.
The rest code is in MainWindow.xaml.cs:
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
TestFrameContent();
}
private void TestFrameContent()
{
FrameworkElement fe = Activator.CreateInstance(Type.GetType("WpfFrameContentProblem.Page1")) as FrameworkElement;
Frame frmContainer = new Frame();
frmContainer.Content = fe;
Debug.Assert(frmContainer.Content != null, "Content is null");
}
}
Run the app, it will fail on Debug.Assert, indicate that frmContainer.Content == null.
It's really a mystery to me, that a simple assignment will fail. Anyone?