未找到 Silverlight 页面 - 导航应用程序

发布于 2024-10-26 17:30:09 字数 2389 浏览 5 评论 0原文

您好,我在使用 Silverlight 导航应用程序时遇到问题(使用 Silverlight 4、.NET 4、MS VisualStudio 2010) 我创建了带有 MainPage 和两个页面的导航应用程序 - 主页和关于。 唯一的修改是在主页代码如下。

当我运行项目时,我收到错误“遇到未知错误。请联系您的管理员以获取更多信息。错误详细信息:找不到页面:“/Home””“

出了什么问题??? :(


主页.xaml

<navigation:Page xmlns:toolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit"  xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"  x:Class="Nav.Home" 
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"
xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"
mc:Ignorable="d" d:DesignWidth="640" d:DesignHeight="480"
Title="Home"
Style="{StaticResource PageStyle}">
    <Grid x:Name="LayoutRoot">
        <ScrollViewer x:Name="PageScrollViewer" Style="{StaticResource PageScrollViewerStyle}"></ScrollViewer>
        <StackPanel x:Name="ContentStackPanel" Background="{x:Null}" Margin="0,0,0,-28">
            <Slider Height="16" Name="sliderVariableCount" Width="300" Minimum="2" Maximum="8" SmallChange="1" ValueChanged="sliderVariableCount_ValueChanged" />
            <TextBox Height="53" Name="tbDump" Width="432" />
        </StackPanel>
    </Grid>
</navigation:Page>

主页.xaml.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace Nav
{
    public partial class Home : Page
    {
        public Home()
        {
            InitializeComponent();
        }

        // Executes when the user navigates to this page.
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
        }

        private void sliderVariableCount_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
        {
            tbDump.Text = sliderVariableCount.Value.ToString();
        }
    }
}

Hello i have problem with Silverlight Navigation application (Using Silverlight 4, .NET 4, MS VisualStudio 2010)
I have created Navigation Application with MainPage and two pages - Home adn About.
Only modification is in Home page code is bellow.

When i run project i get error "An unknown error was encountered. Please contact your administrator for more information. Error details: Page not found: "/Home" "

What's wrong???? :(


Home.xaml

<navigation:Page xmlns:toolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit"  xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"  x:Class="Nav.Home" 
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"
xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"
mc:Ignorable="d" d:DesignWidth="640" d:DesignHeight="480"
Title="Home"
Style="{StaticResource PageStyle}">
    <Grid x:Name="LayoutRoot">
        <ScrollViewer x:Name="PageScrollViewer" Style="{StaticResource PageScrollViewerStyle}"></ScrollViewer>
        <StackPanel x:Name="ContentStackPanel" Background="{x:Null}" Margin="0,0,0,-28">
            <Slider Height="16" Name="sliderVariableCount" Width="300" Minimum="2" Maximum="8" SmallChange="1" ValueChanged="sliderVariableCount_ValueChanged" />
            <TextBox Height="53" Name="tbDump" Width="432" />
        </StackPanel>
    </Grid>
</navigation:Page>

Home.xaml.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace Nav
{
    public partial class Home : Page
    {
        public Home()
        {
            InitializeComponent();
        }

        // Executes when the user navigates to this page.
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
        }

        private void sliderVariableCount_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
        {
            tbDump.Text = sliderVariableCount.Value.ToString();
        }
    }
}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

提笔落墨 2024-11-02 17:30:09

我相信这是在 Visual Studio 2010 和 Internet Explorer 9 中将 Silverlight 导航应用程序与 SOAP Web 服务一起使用时的一个错误。与 Visual Studio 开发服务器 Cassini 有关,或者看起来是这样。解决方法是避免使用导航应用程序模板。

I believe this is a bug when using Silverlight Navigation application with a SOAP web service in Visual Studio 2010 and Internet Explorer 9. Something to do with Visual Studio Development server Cassini, or so it seems. A workaround is to avoid the Navigation app template.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文