locked
Using Same Xaml file for both Windows and Web application. RRS feed

  • Question

  •  

    Hello Everyone,

     

    We are making an WPF application with the same functionality and GUI both for Windows and Web application.

    For this, I want to create a single XAML file for both Windows and Web application.

    Can anyone tell me how do i achieve this?

     

    Thanks in advance.

     

    Regards,

    Sunny.

    Monday, February 11, 2008 5:47 AM

Answers

  • Page could be used in standalone WPF applications, you can generalize the situation by using Page instead.

    Hope this helps
    Wednesday, February 13, 2008 4:29 AM
  • For some examples on how to do this, check this dockingControl demo. The 2 demo apps are in both xbap and normal app using the same code.  The main window of the app simply uses a page that gets shared among both xbap an normal app.  A custom msbuild script is used to share comon code across 4 apps.

    Wednesday, February 13, 2008 8:13 AM

All replies

  • There are a couple of ways you can do this. 
    -First of, you can always copy the files over to a different project, but that's probably not what you want. 
    -You can put all the common stuff in a seperate lib which both xbap and normal app use.
    -put all the common stuff in a common directory, make a msbuild script for them which you can include in the build scripts of both applications.
    Monday, February 11, 2008 8:14 AM
  • Hi bragi,

     

    Thank you for answering.

     

    One thing I am concerned about is the root element of the Xaml file. For the windows application, normally it is <Window> and for a web application, it is <Page>.

     

    So how can i create a XAML file in a Class library (do i need to add a 'Page(WPF)' or 'Window(WPF)' to the Class Library project) and how to make it more generalised so that i can use it both for Windows and Web?

     

    Regards,

    Sunil Jain.

     

    Tuesday, February 12, 2008 7:06 AM
  • Page could be used in standalone WPF applications, you can generalize the situation by using Page instead.

    Hope this helps
    Wednesday, February 13, 2008 4:29 AM
  • For some examples on how to do this, check this dockingControl demo. The 2 demo apps are in both xbap and normal app using the same code.  The main window of the app simply uses a page that gets shared among both xbap an normal app.  A custom msbuild script is used to share comon code across 4 apps.

    Wednesday, February 13, 2008 8:13 AM