开发者

navigation framework in silverlight 3 skipping constructor when usercontrol is of a derived type

I am using the NavigationFramework in Silverlight 3, and am running into issues where the constructor of the UserControl in the xaml I am loading is not being called, and I believe this is because the UserControl in the xaml I am calling is actually derived from another user control.

I have stepped through the debugger with specific break points and the constructor is being ignored completey.

I have MyWindowBlue which is of type uctrlBaseMyWindow.

The constructor for uctrlBaseMyWindow is being called when the xaml is 'navigated to' but the constructor for MyWindowBlue is being ignored.

This is not the case if I add the user control via markup directly.

Anyone else have this issue?

The code I am using to navigate to the MyWindowBlue is

            this.MyContentFra开发者_C百科me.Navigate(new Uri("/Controls/uctrlMyWindowBlue.xaml", UriKind.Relative));

Has anyone run into this or could offer any help?

Thanks


Found the error in my code.

This was due to an error in my XAML. I had moved the user control to a different folder, and so the c# code behind had a type of the same name in one location in the namespace, but the XAML markup had the type in a different location (the original folder), and so the partial class with the constructor was not linked to the type I was actually instantiating.

I fixed the type reference to point to the proper location in the namespace and now the partial class code behind is linked back up.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜