Displaying text and image (RTF) data in WPF & Silverlight - wpf

In our app (Silverlight 5 and WPF) we are looking to put in a help section. The help section will contain simple text and images so thought RTF would be perfect for this. On closer inspection it seems Silverlight doesnt support RTF documents.
What other method could we use to display formatted text / images in both Silverlight and WPF that would allow the content to be generated by a supports person (i.e. no coding knowledge required)

Related

View PdfSharp document in a WPF control

I'm using the companion MigraDoc and PdfSharp libraries to generate a report.
The PdfSharp documentation repeatedly refers to WPF and talks about you can "draw on a PDF page as well as in a window", but I can't figure out how to view my PdfDocument in a viewer. All of the examples just kick the rendering off to another program by opening the documents with Process.Start().
Do either of these libraries include WPF controls for viewing the documents? Ideally I'm looking for a basic document viewer control, similar to the built-in RichTextEditor viewer for FlowDocuments.
(I'm using the PdfSharp and MigraDoc libraries that are distributed through NuGet.)
You can use WPF PDF Viewer. It wraps the Adobe PDF Reader COM Component as a WPF control
PDF Viewer is an ActiveX control which needed to be hosted using WindowsFormHost. If you need a WPF renderer for PDR, Adobe didnt introduced it yet. You need to create it yourself and parse the PDF document.
Here are few links which will help you how to host a PDF document on your WPF window :
http://www.codeproject.com/Articles/380019/Using-Adobe-Reader-in-a-WPF-app
http://hugeonion.com/2009/04/06/displaying-a-pdf-file-within-a-wpf-application/
Telerik has a PDF Viewer created using WPF which does the rendering of a PDF document using WPF. Its called RADPDFViewer
http://blogs.telerik.com/blogs/posts/12-02-29/introducing-pdf-viewer-for-silverlight-wpf.aspx
You have to either use one that is shipped by Adobe or you need to create it of your own just like Telerik did.

How to add an image of a Silverlight UiElement to Word Document

I want to add an image of a certain DataGrid in silverlight to a word Document.
I've created a WriteableBitmap of the DataGrid but I can't find how to copy this image to the word document.
It doesn't have to be a WriteableImage. Any solution that works is fine with me.
Thanks.
Not possible as of Silverlight 5.
In Silverlight 5, access to clipboard information is limited to
Unicode text access. This differs from the WPF implementation of
Clipboard, which enables access to other specific types (for example,
streams or images) or to data objects.
See MSDN.

Silverlight PDF Viewer

I want to be able to show PDF docs within my Silverlight 4 application. I know there is no native support for this and the only real way to do this is to use a third party control. I’ve looked around and found what looks to be a couple of good options, but they are expensive and somewhat limited. I don’t know much about PDF docs, but it seems that most of these controls are converting PDFs to something else; such as XOD or XPS.
I am considering writing my own PDF Viewer for my needs, but not sure where to start on something like this. What would be the best format to convert PDFs to for Silverlight and WPF? If I could convert to RTF, I could use existing controls to display the document.
I’m assuming since there is such a lack of PDF for Silverlight controls out there that this will not be easy. Any help or guidance is greatly appreciated.
Thanks,
-Scott
You do have one more option besides re-implementing a pdf control.
With a bit of javascript and silverlight's DOM bridge, you can render your PDF in the browser's native pdf plugin and display it in a 'window' over the top of your silverlight application.
This is how many of the 3rd party "web browser" controls for silverlight work as well.

RichTextEditor for silverlight 4

Is there any editor control in Silverlight 4?
I just want the basic functionality; much what Stackoverflow has while posting question. The basic stuff like making it bold, italic, etc. I saw Telerik's editor control. However, I'd rather not use it because it is a very large assembly of 1 MB. After already adding a few of Telerik's assemblies, my XAP size is above 2 MB.
Have you considered just using code around the built in RichTextBox?
Download sample from the MSDN documentation at http://msdn.microsoft.com/en-us/library/ff426926(v=VS.95).aspx.
Something to consider though is what ultimately you want to do this this Rich text? The built in control use Xaml to describe the rich text which isn't much use to you if ultimately you need to expose it in an email.

What controls should I use on a Silverlight website for loading textual content?

I am embarking on development of a Silverlight based website. I am the lone developer and am doing it on my own (ie, not for any company).
Now I want to load a lot of textual content on the website along with animations and rich user interfaces that can be created using Silverlight. The text content may change from time to time and when that happens, I don't want to do a lot of rework. So I m thinking to load the text from a Word/text file into controls and whenever new content arrives/existing content is modified, I just have to append it to the Word/text file.
This way the application itself remains untouched, only the file contents keep changing. Silverlight doesn't support FlowDocument. RichTextBox doesnt have a Load or LoadFile property. So how do I go about this? Should I make use of Frame, Downloader and similar other controls as well? What do you suggest? What would be the best approach to this?
The RichTextBox does have a Xaml property so you could download Xaml files containing the restricted set of textual elements that RichTextBox supports. You could also create a Silverlight editor around which you could create and upload this Xaml text content.
However have you considered whether Silverlight is the right platform to deliver primarily textual content? HTML is pretty good at that and with frameworks such as JQuery you can create quite interactive experiences that work well across browsers.

Resources