locked
The type PageFunction was not found. RRS feed

  • Question

  • When I use PageFunction in an xaml file that is loaded into the VS2008 designer, I get the context editor error:

    The type 'PageFunction' was not found.

     

    This is not a huge problem, as everything builds and runs just fine.  But I have noticed that since I made the change from Page to PageFunction, I can't seem to auto create code stubs (say from Click= ) from the xaml editor, as it complains that there is no x:Class attribute in the root element - even though there is.  I am guessing that's because of the error with it not recognizing the PageFunction type.

     

    Anyway, just wondering if this is a bug, or if I've not set up something correctly in order to allow the xaml editor to know about the PageFunction type.

     

    Thanks!

    TWR

     

     

    Sunday, December 30, 2007 3:56 PM

Answers

  • Yes this is an issue in VS 2008. We have since addressed this issue and expect it to be included in VS 2008 SP1. My apologies for the time this issue has cost you

    mark

     

    Wednesday, January 2, 2008 7:08 PM

All replies

  • I'm going to guess that you failed to specify a the x:TypeArguments attribute.  PageFunction is a generic type, and can't be used within XAML without specifying the x:TypeArguments attribute.
    Sunday, December 30, 2007 9:50 PM
  • Thanks for the reply, but I checked and I do have it.  Here's how it looks right now:

     

    Code Block

    <PageFunction

    x:Class="TestStuff.LoginWindowUI"

    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

    xmlns:local="clr-namespace:TestStuff"

    x:TypeArguments="local:MyPageResult"

    KeepAlive="True"

    FocusManager.FocusedElement="{Binding ElementName=LoginNameBox}"

    WindowTitle="Login"

    Title="LoginWindowUI">

     

     

    As I mentioned, it works fine - in the sense that it *builds* and *runs* just fine.  But the Intellisense puts a little squiggle under the PageFunction word and also seems unhappy about trying to do auto stubbing in the code behind.  But the code behaves correctly for build and run.

     

    Thanks for the idea though...

    TWR

    Monday, December 31, 2007 6:02 AM
  • Interesting.  I've not had any issues like this.  Try this simple example and see if it gives you the same problems.

     

    Code Block

    <PageFunction
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:sys="clr-namespace:System;assembly=mscorlib"
        x:Class="WpfNavigation.TestPageFunction"
        x:TypeArguments="sys:String"
        Title="TestPageFunction">
      <Grid>
            <Button>OK</Button>
      </Grid>
    </PageFunction>

     

     

    Code Block

    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 WpfNavigation
    {
        /// <summary>
        /// Interaction logic for TestPageFunction.xaml
        /// </summary>
        public partial class TestPageFunction : PageFunction<String>
        {
            public TestPageFunction()
            {
                InitializeComponent();
            }

        }
    }

     

     

    Monday, December 31, 2007 2:16 PM
  •  TWR wrote:

    As I mentioned, it works fine - in the sense that it *builds* and *runs* just fine.  But the Intellisense puts a little squiggle under the PageFunction word and also seems unhappy about trying to do auto stubbing in the code behind.  But the code behaves correctly for build and run.


    Have you tried clearing the solution and rebuilding it (Build -> Clear Solution ->  Build Solution)?

    Tuesday, January 1, 2008 2:17 AM
  • I was in the midst of tons of half-done code, so it took a while to get back to a buildable state.  I have done a build clean and then rebuilt, with no errors and no warnings, and the code runs fine.  But I still have the little squiggle in the XAML editor, with the pop-up (tool tip style) error description as above.

     

    At this point, since no one else has chimed in saying "me too" I am going to guess that I have something wrong with my overall environment.  This laptop did previously have a beta of VS 2008 installed, and so while I diligently followed the steps for uninstall, there's always a chance that something is Not Quite Right.  At some point I will move the project onto one of my sons' machines (which never had VS 2008 beta) and see if that fixes the problem.

     

    Thanks,

    TWR

     

     

    Wednesday, January 2, 2008 2:03 AM
  • I'm pretty sure that this is a limitation in the designer, not a problem with your setup - I'll check and get back to you - mark

     

    Wednesday, January 2, 2008 5:27 PM
  • Yes this is an issue in VS 2008. We have since addressed this issue and expect it to be included in VS 2008 SP1. My apologies for the time this issue has cost you

    mark

     

    Wednesday, January 2, 2008 7:08 PM