开发者

Why is my URI messed up when using NavigationService?

A "simple" situation:

Assembly1 contains:

  • A couple of WPF Pages (.xaml)

Calling Assembly contains:

  • A WinForm with an ElementHost
  • The ElementHost contains a WPF UserControl that has a single Frame (=MainFrame)

The WinForm uses the NavigationService from the MainFrame to navigate to an absolute Uri in a like this:

NavigationService.Navigate(new Uri("pack://application:,,,/Assembly1;component/Page1.xaml", UriKind.Absolute);

Navigated page is displayed, all fine until now. Now when I look at the NavigationService.CurrentSource (which is the Uri of the currenlty loaded page) it looks like this:

Why is my URI messed up when using NavigationService?

All kinds of Exceptions...And what is also weird is that the property IsRelative is True and the OriginalString property states : "/Assembly1;component/Page1.xaml". The whole "pack-part" is lost. So when using the Uri again (what i would like) results in errors because this Uri d开发者_高级运维oesn't give me a correct path anymore.

Am I missing some essential part of the NavigationModel in WPF? Any help would be appreciated!


What I choose as a solution is to pick up the

NavigationService.CurrentSource

and paste the "pack-part"in front of it again. Then use it again for navigation.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜