Skip to Content

In an earlier blog post I demonstrated how you can create visual components in PowerBuilder.Net and then use them from within Visual Studio (including the Express version that you can download free of charge from Microsoft).  What I created in Visual Studio for that demonstration was a WPF application, but there are other things you can do with PowerBuilder.Net visual components when you get them into Visual Studio.  One of those is to create a WPF Browser Application.

A WPF Browser Application (also called ‘XBAP’, short for XAML Browser Application) is a method of running WPF applications within a browser and still maintain rich client functionality.  Think of it as the half way point between ClickOnce (in which the application is simply distributed through the browser, but runs independently on the local machine) and SilverLight (where the application runs within the browser).  An XBAP application runs ‘within’ the browser to the extent that it uses it as the host that it displays in, so it appears to be a web application.  Like ClickOnce, it requires that the .Net Framework is was written referencing be deployed on the client, and will prompt the user to install it if it is not available.

In order to run XBAPs within Internet Explorer you must first customize one of the security settings to enable them.  The plugin that allows XBAPs to run within Firefox is distributed with .Net Framework 3.5.  Once it is installed, adding the location to it to the system path then enables Chrome and Opera to run XBAPs as well.  This site provides extensive details on getting the various browsers configured correctly.

XBAPs normally operate under partial trust.  However, depending on what your application needs to do you may need to elevate it’s permissions to allow it to operate under full trust.  This site provides detains on enabling an XBAP to run under full trust.  For the sample app I used in that demo I needed to configure the XBAP to run under full trust because I wanted to do a binding redirect on the Oracle ODP.Net libraries and a binding redirect requires full trust.

Note that you will need to use PowerBuilder 12.5.1 (the maintenance release, not the original 12.5 release) in order to create the visual component.  One of the significant enhancements in that maintenance release was support for compiling applications and components to support x64 and AnyCPU targets.  Assemblies created for use in XBAP applications have to target AnyCPU.

Having said all that, here’s what the sample component looks like when compiled as an XBAP and then accessed via Internet Explorer:

/wp-content/uploads/2013/02/internet_explorer_188550.png

Here’s the same XBAP being accessed from Firefox:

/wp-content/uploads/2013/02/firefox_188551.png

From Chrome:

/wp-content/uploads/2013/02/chrome_188555.png

And finally from Opera:

/wp-content/uploads/2013/02/opera_188556.png

To report this post you need to login first.

2 Comments

You must be Logged on to comment or reply to a post.

  1. Former Member

    I have to wonder why you can’t generate an XBAP application directly from PB.Net. Do you think it would be fairly straight forward for SAP to implement that?

    (0) 
    1. Bruce Armstrong Post author

      Actually you can.  See this stackoverflow thread.

      At one point I was working on converting the PEAT demo application from PFC over as a demo.

      Response windows are an issue though.  An XBAP can only have one window, so you have to keep everything as a child of the original window.

      Also, WPF applications start with a Window element and XBAP are supposed to start with a Page element.  The Page element keeps the application running in the browser.  Because PB uses a Window instead, it opens up outside the browser.  Not the effect I was looking for, as you could do the same with a ClickOnce deploy.

      It would help if SAP would provide some capability natively within PowerBuilder to support it, like supporting a Page element initial window type and doing something about making the RunWPFApp call optional.

      (0) 

Leave a Reply