How do I add a XAML page to a Universal App?

I created a new Blank App. Everything works as it should. Now I want to add a new page. This is the wrong way I'm doing it:
First, I add a new Blank Page to the Windows Project
foo.xml.cs
namespace testapp
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class foo : Page
public foo()
this.InitializeComponent();
Then I add the same class name to the Shared project
foo.cs
namespace ZUMOAPPNAME
class foo
I modify foo.cs to
namespace testapp
public sealed partial class foo
public void shared()
win();
And then add a method to foo.xaml.cs to make it
namespace testapp
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class foo : Page
public foo()
this.InitializeComponent();
public void win()
shared();
The win method can call the shared method.
However, for the shared method, the compiler gives me this error:
The name 'win' does not exist in the current context
What's the proper way to add a new page?

Hi Greg,
Take a look at my blog entry
Strategies for sharing code in XAML-based Universal apps
As Magnus notes, all parts of a partial class need to be in the same namespace to be part of the same class. ZUMOAPPNAME.foo and testapp.foo are unrelated classes.
It's not clear exactly what you're trying to do here, but a common pattern is to have different Xaml for the Windows and WindowsPhone projects but to share data. A good way to do that is to create the new page with the same name (for example: "foo")
in both the Windows and WindowsPhone projects. This will add a foo.xaml and foo.xaml.cs file in each and will define the foo class in both foo.xaml.cs files.
You can then add a foo.cs file in the shared project with your shared functions:
Shared/Foo.cs:
namespace testapp
public sealed partial class foo
public void shared()
do_shared_stuff();
do_plat_specific_stuff();
And call it from the platform specific functions:
Windows\foo.xaml.cs:
namespace testapp
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class foo : Page
public foo()
this.InitializeComponent();
shared();
public void do_platform_specific_stuff()
// do windows stuff
You can use this to mix and match as much as you'd like. If you have very straigtforward UI you may be able to copy the entire .Xaml and .Xaml.cs into the shared directory or you may have platform specific Xaml but share the Xaml.cs file. In most cases you'll
have a mix of platform specific xaml and code and shared code.

Similar Messages

  • How do i add a second page to a document in Pages 5.2.2

    How do I add a second page to a document in Pages 5.2?

    Hello jeddi17,
    You can insert a page break with the Insert (menu) > Page Break.
    Note if your typing overflows the first page, then a new page is automatically created.
    Pages for Mac 5.0: Change the flow of text
    http://support.apple.com/kb/PH15334
    Force text to the next line or page
    A line break, also called a soft return, starts a new line without starting a new paragraph. A page break moves the next line of text to the top of the next page.
    Click where you want the break to occur.
    Do one of the following:
    For a line break: Press Shift-Return. 
    For a page break: Click Insert in the toolbar, then choose Page Break.                                
    Take care,
    Nubz

  • How do I add and delete pages to a pdf document?

    How do I add and delete pages to a pdf document?

    Hi Paul,
    Adobe Acrobat has the features to add/delete/extract/crop/insert pages to your PDF files and are much more features.
    Adobe Reader has  a very limited features for editing to PDF files.
    Now you can subscribe to Acrobat Plus and see more information at https://www.acrobat.com/acrobatplus/en/home.html
    Or you can download Acrobat XI Pro for trial version from www.adobe.com.
    thank you.
    Hisami

  • How do I add or delete pages from a scanned document

    how do I add or delete pages from a scanned document

    There are a few ways but mostly, select the pages go to the tools panel>Pages and choose delete page.

  • How do I add citations to Pages? The EndNote plugin is not available.

    How do I add citations to Pages? I tried downloading the suggested EndNote Plugin but it says the webpage is not available anymore.

    To add citations you have to buy EndNotes from http://endnote.com/. The endnote plugin you get from http://support.apple.com/kb/DL1334   but it is only for those who bought Pages from the MacAppStore
    Read this http://support.apple.com/kb/TS3587

  • How do I add an offline translation to the Bible app to use it when not connected to a network?

    How do I add an offline translation to the Bible app to use it when not connected to a network?

    You will need to contact the developer of the app and ask if that is possible. If not, you'll need to look for another app that doesn't require a network connection to function.
    Regards.

  • I just found out that Apple has ceased supporting iWeb!  I have a large (50  pages) website developed with iWeb and hosted through GoDaddy.  Is there information out there about how I can move my website pages to a supported app?

    I just visited the Apple Store to investigate a new MacBook Air.  I found out that iWeb is no longer supported!!  I currently have a MacBook Pro that is less than 2 years old, running OS10.7.5.   I have a large website that I developed using iWeb (hosted by GoDaddy).  Does anyone know how I can migrate my 50+ pages to some new app?  Is there some new app?  Or will I have to start over from scratch? Ugh!!!  Thanx.

    You can still use iWeb 3 to maintain your webiste.  Just copy the Domain.sites2 file from the your Users/Home/Library/Application Support/iWeb folder on your MBP to the same folder on your MacBook Air.  Also copy the iWeb application from your MBP to the Applications folder on the MBA.
    In Lion and Mountain Lion the Home/Library folder is now invisible. To make it permanently visible enter the following in the Terminal application window: chflags nohidden ~/Library and hit the Enter button - 10.7: Un-hide the User Library folder.
    To open your domain file in Lion or Mountain Lion or to switch between multiple domain files Cyclosaurus has provided us with the following script that you can make into an Applescript application with Script Editor. Open Script Editor, copy and paste the script below into Script Editor's window and save as an application.
    do shell script "/usr/bin/defaults write com.apple.iWeb iWebDefaultsDocumentPath -boolean no"delay 1
    tell application "iWeb" to activate
    You can download an already compiled version with this link: iWeb Switch Domain.
    Just launch the application, find and select the domain file in your Home/Library/Application Support/iWeb folder that you want to open and it will open with iWeb. It modifies the iWeb preference file each time it's launched so one can switch between domain files.
    WARNING: iWeb Switch Domain will overwrite an existing Domain.sites2 file if you select to create a new domain in the same folder.  So rename your domain files once they've been created to something other than the default name.
    If you want to learn about potential preplacements (which have been discussed extensively at length in this forum) do a search for  "iweb replacement".
    OT

  • How do I add a web page to top sites in Yosemite?

    How do I add and lock in a web page to top sites in Yosemite?

    Took me some time to figure it out, but here's how to add.
    Go to the page you want to add.
    when you hover the mouse curso over the address bar, a circle with a "sign" will appear ...
    Click on it and keep the mouse button pressed.
    A list should appear, just select "Top Sites" ...
    That's it !

  • How do you add fonts in pages?

    How do you add fonts and clip art in pages? I seem to have few fonts in pages. New to Mac. Thanks! Also seems that there is no clipart in pages? If there is, where can I find it?

    On the Mac you add fonts to the System by double clicking on them, they then get opened in Font Book where you can open/close and organise them.
    Most ClipArt offered with other applications is rubbish. Apple has left it to you to source your own, better material. This may help:
    http://www.freeforum101.com/iworktipsntrick/viewforum.php?f=12&mforum=iworktipsn trick
    Peter

  • How do I add fonts to pages for ipad?

    I would like to add fonts to use in pages on my iPad.
    How do I add fonts?

    You are limited to the fonts included in the apps, there is no way to add outside fonts. Pages comes with some nice ones, however. See the product's included help how to make use of them.

  • How can i add a template page on my document ? Pages 5.0

    Hi to everyone.
    I have a problem after i updated Pages to the new one (5.0 (1465)). I'm not able to add a template page (for exemple chapter page or photo page or so on), while i'm writing my document. How can i do it ?
    (For example with Keynote i have only to click on "+" in the left bottom corner, and i can choose wich slide i want).
    Can someone help me please ? I need that for my thesis.
    Thank you so much

    If you use the Help menu in Pages 5.0 you will be linked to http://help.apple.com/pages/mac/5.0
    Here is soem of the text you get from the search add custom template.
    Save a document as a template
    Choose File > Save as Template (the File menu is at the top of your computer screen).
    Click one of the options:
    Add to Template Chooser: Type a name for the template, then press Return. Your template appears in the My Templates category in the template chooser.
    Save As: Type a name for the template, then choose where you want to save it.

  • How can I add a blank page in Pages 5?

    No manipulation from the thumbnail window. I am so frustrated by this new downgrade! Thanks Apple for sacrificing OS X-based Pages which has only brought a mediocre application...

    Bookmarks have been removed along with 100 other features.
    You could post at Menu > Pages > Provide Pages Feedback but that is pointless in my experience
    Instead rate/review Pages 5 in the App Store where everyone can see it. In our local App Store, Pages 5.1 is back down to 2 stars with again 61% of users saying they hate it.
    Pages '09 should be in your Applications/iWork folder, use that instead.
    Peter

  • How do I add my Hotmail account to my Mail app on my MacBook Pro so that it synchronize automatically ?

    Hi guys, I'm new to Mac. I know that you can add email accounts likeHotmail into your Mail app so that you can view, edit, modify, create and delete your emails and folders, etc. The questions I have are (1) can I see all the emails I have not just in the inbox but all the other folders as well just like if I was logging on to Hotmail via Internet Explorer ? (2) what happens if I read some emails, delete or move some emails, create new emails and send or save in draft, create or delete folders, etc in the Mail app on my MacBook Pro, will this synchronize and reflect the same on my Hotmail account if I was to logging via Internet Explorer ? How about the other way ? If so, how do I set it up on my MacBook Pro to do this automatically ?
    I know that this doesn't work with Hotmail accounts on my iPhone 4 via the Mail app. Everytime I read an email or delete an email on my Mail app, it does not synchronize or reflect the same on my live Hotmail account when I logging via Internet Explorer.
    Any help, guidance or advise would be appreciated. Thanks.

    Edit: never mind, I was using the wrong password

  • How do I add a book(pdf) into my Kobo app on my iPhone

    How can I add books that I want to read to my Kobo app on my iPhone?
    How do I add some of my videos into my flex player app or my iMedia player app? If I do add a video which will it play under?

    Connect the phone to your computer and click on its icon in your computer's iTunes to select it. Then select the phone's Apps tab, and scroll down the screen to the 'file sharing' section - select the Kobo app on the left-hand side of that part of the iTunes screen, and on the right-hand side add the PDF(s) to the app. Or if the PDFs or epubs are on a website then you might be able to use 'open in' in Safari to copy them to it
    If those other apps support the file sharing section then you should be able to use the above to copy videos into them from your computer (you won't be able to play iTunes purchased videos in them ).

  • How do I add a reply form to a Web App?

    I am building a webapp that allows the client to submit work requests for updates to their website as there are far too many people involved in email and it gets confusing very quickly.
    I have figured out how to have them submit a web app item and view the details of that item, but I would like to have a simple web form that allows the client to reply to a web app item and have the result of that show up on the detail page of the web app item. Is this possible to do? I would really appreciate some help on this. Thanks.

    If by 'have the result of that show up on the detail page' you are reffering to the contents of the reply, then, off the top of my head, what you could do is make use of CRM Cases!
    ie;
    Create a workflow (let's call the workflow 'appReplies')
    Create a form and attach it to the appRelies workflow.
    Place the form where needed.
    Place the relevant case module in the app detail view eg {module_case,c,xxxxx}
    @webmosphere
    www.webmosphere.co.uk

Maybe you are looking for

  • My library vanished.

    I left my itunes library unattended for a few hours, my ipod was not connected but the window was open on the screen. When I came back the library was empty, I connected my ipod and nothing changed. It said that all of my playlists were empty as well

  • Billing for service orders

    I need to be able to bill for some of the service orders as a requirement of my client. Has anyone done the config in SD for this before? If I do not want to use SD is there another option to use? Any help would be great and will award points. Thanks

  • Idoc in xi

    hi all, i want to know that how idoc help in sap xi, how it used in sap xi. thank you.

  • QoS System Class change MTU from 9000 to 9126..?

    Hi, I want to change the UCS "QoS system Class" MTU for the "Best Effort" class' MTU from 9000 bytes to 9126 as per: http://www.cknetworx.net/?tag=ucs-jumbo-frames      and/or http://www.cisco.com/en/US/docs/unified_computing/ucs/UCS_CVDs/esxi51_ucsm

  • Fragmented volume directory

    Ran TechTool Pro 7 suite of tests and found no problems. When I tried to optimize the drive, it was not allowed. Message says the volume directory is fragmented. Please help. OS X 10.9.3