Reputation: 8431
I want to do something like this:
var iFrame = new Frame();
var iPage = new Page(new Uri("/Views/MyPage.xaml", UriKind.Relative));
// ^ this must be the parameter on creating the page
iFrame.Content = iView;
tabCtrl.Content = iFrame;
Wherein, I want to open the page using the path instead of instantiating the page itself which is functionally correct like this:
var iFrame = new Frame();
var iPage = new MyPage();
iFrame.Content = iView;
tabCtrl.Content = iFrame;
My idea is to use a maintained path for the Page stored in the database. Any thoughts?
Upvotes: 3
Views: 3445
Reputation: 3653
Something like this?
System.Uri resource = new System.Uri(@"Views\MyPage.xaml", System.UriKind.RelativeOrAbsolute);
Something.Content = System.Windows.Application.LoadComponent(resource);
Upvotes: 3
Reputation: 29006
Let myUserControl.xaml
be the user control, then you can add this user control to the tabbed item as like the following;
myUserControl myUserControlObject= new myUserControl();
tabCtrl.Content=myUserControlObject;
and you have to import the myUserControl
class like: using project.Views
since it belongs to view namespace. check whether a page can be added like this or not
Upvotes: 0