locked
Type not defined error when creating a PageFunction with a custom type RRS feed

  • Question

  • When creating a PageFunction I get the error ... type "StructuredNavigationSample.CustomType" is not defined.

    Background:

    I am using VS2010 and Framework 4.

    All my VB code is without a namespace declaration, the project has a root namespace declared as 'StructuredNavigationSample'.

    I would be grateful for any suggestions as to what I am doing incorrectly ...

    Sample code is as follows:

    CustomClass.vb:
    -------------------

    Public Class CustomType
        Public Property ctString As String
    End Class

    Called PageFunction xaml:
    ------------------------------

    <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="PageFunction1"
        xmlns:local="clr-namespace:StructuredNavigationSample"
        x:TypeArguments="local:CustomType"
        Title="Page Function" WindowWidth="250" WindowHeight="150">

    When a try to build/run I get the error "StructuredNavigationSample.CustomType" is not defined.

     

    Wednesday, September 1, 2010 3:03 AM

Answers

  • Hi Siggy01,

    The cause is that the VB class name is different with the class file name, if you change to reference to the "local:CustomClass" (the file name), it can be built.

    I am confuse why the PageFunction in VB.Net requests the class file name as the TypeArguments, not the class name. I have started a internal consultation, and feedback I get, I will update here. Now, the workaround is to make the class file name same with the class name in VB.Net.

    Sincerely,

    Bob Bao

    MSDN Subscriber Support in Forum 

    If you have any feedback on our support, please contact msdnmg@microsoft.com


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    • Marked as answer by Siggy01 Wednesday, September 22, 2010 11:23 PM
    Thursday, September 2, 2010 2:34 AM