System.Windows.Markup.XamlParseException

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Bubbs
    New Member
    • Nov 2007
    • 17

    #1

    System.Windows.Markup.XamlParseException

    I keep getting this exception when i run the program. It is driving me insane. Does anyone know whats wrong and how do i fix this!

    System.Windows. Markup.XamlPars eException was unhandled
    Message: Cannot create instance of 'Page1' defined in assembly 'ArcForex.com, Version=1.0.0.0 , Culture=neutral , PublicKeyToken= null'. Exception has been thrown by the target of an invocation. Error in markup file 'Page1.xaml' Line 1 Position 7.


    Page1.xaml

    Code:
    <Page x:Class="Example.com.Page1"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="Page1" Height="192" Width="999">
        <Grid Background="Azure">
            <Image Source="C:\banner.jpg"  Margin="17,0" Name="image1" Stretch="Fill" Height="84" VerticalAlignment="Top" />
        </Grid>
    </Page>
    Page1.xaml.cs

    Code:
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Windows;
    using System.Windows.Controls;
    using System.Windows.Data;
    using System.Windows.Documents;
    using System.Windows.Input;
    using System.Windows.Media;
    using System.Windows.Media.Imaging;
    using System.Windows.Navigation;
    using System.Windows.Shapes;
    
    namespace Example.com
    {
        /// <summary>
        /// Interaction logic for Page1.xaml
        /// </summary>
        public partial class Page1 : Page
        {
            public Page1()
            {
                
                    InitializeComponent();
                
            }
        }
    }


    Thanks
    Last edited by kenobewan; Oct 4 '08, 12:51 PM. Reason: !n invalid
  • Bubbs
    New Member
    • Nov 2007
    • 17

    #2
    Btw, Im making a silverlight page called Example.com

    Comment

    • Plater
      Recognized Expert Expert
      • Apr 2007
      • 7872

      #3
      Is this:
      xmlns:x="http://schemas.microso ft.com/winfx/2006/xaml"
      Point to a valid dtd schema for "x" ?

      Comment

      • Curtis Rutland
        Recognized Expert Specialist
        • Apr 2008
        • 3264

        #4
        That is a standard schema used in Silverlight.... that isn't the problem.

        Unfortunately, I can't see what the problem is...

        Comment

        • Plater
          Recognized Expert Expert
          • Apr 2007
          • 7872

          #5
          Would it care about being Example.Com.Pag e1 in assembly 'ArcForex.com' ?

          Comment

          • Curtis Rutland
            Recognized Expert Specialist
            • Apr 2008
            • 3264

            #6
            OK, I know this is weird, but give it a try...(because I googled your error message and found something like this)

            Maybe it doesn't like an absolute path to the image....try adding the image to the project, and giving it a web-style path relative to the project.

            So if you made a folder in the project called images, the path would be
            images/filename.jpg

            Try that and see what happens.

            Comment

            • Plater
              Recognized Expert Expert
              • Apr 2007
              • 7872

              #7
              That would actually make a lot of sense, frequently you would not be allowed out of the web application's "root", particularly for html elements(Same would apply for xml elements used?)

              Comment

              • Curtis Rutland
                Recognized Expert Specialist
                • Apr 2008
                • 3264

                #8
                Yeah, since this will be deployed via the web, you wouldn't be able to access local resources anyway...so that might be the problem right there.

                Comment

                • Bubbs
                  New Member
                  • Nov 2007
                  • 17

                  #9
                  thanks guys. Got it working.

                  Comment

                  Working...