views:

246

answers:

1

In our application, we allow administrators of an install to design templates for name tags that are printed when they check-in from a kiosk (sort of like checking in for a flight at a kiosk and printing out a boarding pass).

For example, the template might look something like this:

[FirstName] [LastName]
[Company]
[PersonImage]
[BarCode]

Right now, we use Reporting Services to allow our administrators to design templates for name tags (some might want a picture of the person, a bar code printed out, name of their organization, etc). This works ok, but 1) Reporting Services is slow to render and 2) it's not integrated with our application very well -- they have to load up Visual Studio and design the name tag outside of our application.

XAML seems like a good fit for designing the template for name tags. Virtually any design could be handled with the format and we could use XAML to XPS to print.

The problem I'm seeing is how to integrate a visual designer that uses a subset of available XAML controls. We'd really only need simple controls such as Canvas, Grid, TextBlock, Image, etc with drag/drop support. I'm not finding much info on whether or not it's possible to host Visual Studio or Sparkle's XAML designer into a separate application. Anyone have any ideas? The RichTextBox looks like it would almost work, but a FlowDocument isn't really want we're wanting. We need to be able to drag items around and absolutely position them (like in a report designer).

+3  A: 

I'm not sure whether you can host the MS designer/s (although I doubt it), but I think you might be able to produce your own mini-editor fairly simply. Start with a Canvas and programmatically add Labels, TextBlocks or whatever else you want (wire them up with Click handlers to move them around via Canvas.Top/Canvas.Left). You can render the Canvas to an image fairly easily for printing, or Xaml-Xps as you mentioned.

Check out Kaxaml as an example of someone who has already whipped up a mini Xaml editor (it was recently updated to SL2). There may be others out there as well.

EDIT 26-Jan-09: also check out Charles Petzold's XamlCruncher (example) - certainly beats loading up Visual Studio - seems like XamlReader.Load might be worth trying out?

CraigD