Bug 21170 - XAML - Unable to create custom base page
Summary: XAML - Unable to create custom base page
Status: RESOLVED INVALID
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 1.1.1
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2014-07-08 06:13 UTC by Anthony
Modified: 2014-07-22 11:09 UTC (History)
4 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED INVALID

Description Anthony 2014-07-08 06:13:35 UTC
Hi,

I noticed that if I create a custom class like so...

public class MyBasePage : ContentPage
{
...
}

And I try to reference it in xaml like so...
<MyBasePage
  x:Class="MyApp.MyPage"
  xmlns="http://xamarin.com/schemas/2014/forms"
  xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
>

...

</MyBasePage>

That I get an error when it compiles because the MyPage.xaml.g.cs is missing the using statement for the MyBasePage.

Error: The type or namespace name 'MyBasePage' could not be found (are you missing a using directive or an assembly reference?
Comment 1 Eric Maupin 2014-07-22 10:27:01 UTC
Marked public at the request of the reporter.
Comment 2 Eric Maupin 2014-07-22 11:09:58 UTC
You must declare the clr namespace in your XAML and reference the class with the namespace prefix.