Reputation: 35
So I'm trying to open a maximum of two apps concurrently, the user, clicks a button listed on the navigation menu and then the app opens in the blank red area of the top level app, like so:
Here is the xaml code for this page:
<Grid Background="#d80202">
<NavigationView x:Name="Navigation">
<NavigationView.MenuItems>
<NavigationViewItem x:Name="Home" Icon="Home" Content="Home"/>
<NavigationViewItem x:Name="Colours" Icon="Edit" Content="Colours"/>
<NavigationViewItem Icon="Admin" Content="Security"/>
<NavigationViewItem Icon="World" Content="Translate"/>
</NavigationView.MenuItems>
</NavigationView>
</Grid>
Here is the code for the mainPage's .cs:
public sealed partial class MainPage : Page
{
public MainPage()
{
this.InitializeComponent();
Debug.WriteLine(Windows.ApplicationModel.Package.Current.Id.FamilyName);
}
private void Navigation_Loaded(object sender, RoutedEventArgs args)
{
}
private async void NavigateToColoursApp_Click(object sender, RoutedEventArgs args)
{
var options = new LauncherOptions();
options.TargetApplicationPackageFamilyName = "e8731a5c-2685-436a-b3c7-983a3b74fb9a_bnk8fdhtvqpqp";
await Windows.System.Launcher.LaunchUriAsync(new Uri("Colours.xaml"), options);
}
private void Navigation_Navigate(NavigationView sender, NavigationViewSelectionChangedEventArgs args)
{
NavigationViewItem item = args.SelectedItem as NavigationViewItem;
if (item != null)
{
switch (item.Content)
{
case "Home":
Frame.Navigate(typeof(MainPage));
break;
case "Colours":
Frame.Navigate(typeof(Colours));
break;
case "Translate":
Frame.Navigate(typeof(Translate));
break;
}
}
}
}
And for an example of the navigation, here is the Colours page's .cs
public Colours()
{
this.InitializeComponent();
Debug.WriteLine(Windows.ApplicationModel.Package.Current.Id.FamilyName);
}
Upvotes: 0
Views: 354
Reputation: 169420
An app cannot be opened "inside" another app. An app is a process that runs in isolation from other processes/apps.
Besides, the type of the Content
property of the SplitView
control is UIElement
which effectively means that you cannot set it to anything else than a UIElement
. And since neither a Window
or an app is a UIElement
, you'll have to rethink your approach here.
Instead of trying to include an entire app into the SplitView
, you should break out its contents into a control that you can display and use in any app.
Upvotes: 2