Note that there are some explanatory texts on larger screens.

plurals
  1. POTesting navigation in silverlight
    text
    copied!<p>I have a Silverlight application that is using a navigation frame.</p> <p>I am trying to write a unit-test for that application using the Silverlight testing framework, however when I execute the test method I get the following error:</p> <pre><code>InvalidOperationException No XAML was found at the location '/Pages/LoginPage.xaml' </code></pre> <p>The unit-test method looks like:</p> <pre><code>[TestMethod] [Asynchronous] public void TestMethod1() { var mainPage = new MainPage(); WaitFor(mainPage, "Loaded"); TestPanel.Children.Add(mainPage); EnqueueCallback(() =&gt; Assert.IsTrue(mainPage != null)); EnqueueTestComplete(); } </code></pre> <p>Here's the MainPage.xaml:</p> <pre><code>&lt;UserControl x:Class="AccurateSilverlight.MainPage" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" d:DesignHeight="577" d:DesignWidth="858" xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk" HorizontalContentAlignment="Center"&gt; &lt;Grid x:Name="LayoutRoot" Background="White"&gt; &lt;Grid Height="36" Name="grid1" VerticalAlignment="Top" Background="#FF9A9A9A"&gt; &lt;ComboBox Height="23" HorizontalAlignment="Left" Margin="6,6,0,0" Name="ModuleComboBox" VerticalAlignment="Top" Width="250" IsEnabled="False" /&gt; &lt;Button Content="Logout" Height="23" Margin="0,7,6,0" Name="LogoutButton" VerticalAlignment="Top" HorizontalAlignment="Right" Width="75" IsEnabled="False" Click="LogoutButton_Click" /&gt; &lt;/Grid&gt; &lt;sdk:Frame Margin="0,35,0,0" Name="NavigationFrame" Source="/Pages/LoginPage.xaml" Navigated="NavigationFrame_Navigated" /&gt; &lt;/Grid&gt; &lt;/UserControl&gt; </code></pre> <p>If I run the "main" xap the application works correctly. I just have that error while testing.</p> <p>I suspect the error is due to the unit-test framework executing its xap and embedding my xap in it, but cannot figure out a way to get around that.</p> <p>Any clues?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload