wpf documentviewer to view different file formats? - wpf

I have a wpf application where the user can upload files with different formats (for now only pdf). I want to use document viewer to let the user see what's been uploaded. Is this possible? If this is not possible, can you suggest an alternative? If this is possible, is this a good solution for this?
Thanks,
Angela

I am currently looking for the same thing : a way to display a pdf document in WPF. DocumentViewer seems targeted on displaying XPS documents. It may display other kinds of documents, but it looks like we should supply our own Document class for that purpose.
So I am going to try displaying my documents using an old workaround : displaying them in an embedded web browser. It is not a good solution in my opinion. Especially for we can not access much document properties using that method (document pages count, pages size, ...). But I do not find any other readily available solution.

Related

wpf app: help files with search and index

We are adding help files to our WPF application in Visual Studio 2010. We have not been able to find so far a method that we have been able to use.
We have some HTML help files, currently they are just in a directory, not added to the WPF project.
We don't have index or search.
I have seen that maybe we can do something with cmh, but this seems quite old and outdated now.
Ideally we would like all this in WPF, but if its not possible we need another solution.
We would like to be able to hit F1, have our main help page displayed (we have this now, it opens in our browser) and additionally add Index and Search to our main help page.
Can anyone point us in the right direction please?
Maybe you should take a look at the Process.Start Method page on MSDN. In particular, the Process.Start Method (String) page has a code example showing how to open web pages from a WPF application.
To do this inside a WPF application, look at the WebBrowser Class page at MSDN. This also provides a code example of loading a web page into your application.
EDIT >>> After re-reading your post, I realise that I missed the bit about searching and indexing. Surely, you can just search through the web pages yourself? Just open each page and use something like
if (webPageContent.Contains(searchTerm)) return webPageContent;

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.

What is the best way of localization LOCBaml or Resx based localization?

I came through this What is the best way to localize a WPF application, sans LocBAML? . But, this didn't answer what I'm looking for.
I'm creating a CustomControl in WPF. I would like to provide localization support. The control contains, images, strings etc.,
Any help would be greatly appreciated.
Thanks
I think the document linked in this post contains a lot of information about localization in WPF. In the end, it is up to you to decide which mechanism to use.
Since you are talking about a custom control, I would consider to give it a Culture dependency property which the consumer of your control can use to specify the desired culture. This way, the consumer can use your localized control, relatively independent of the localization strategy he/she chose.
I'd suggest using Resx, try integrating into a WPF application with the TranslationByMarkupExtension example. http://www.wpftutorial.net/LocalizeMarkupExtension.html
LocBaml was a very odd thing for Microsoft to put out there and isn't better, or even complete.

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.

Another way to display an XPS document using WPF

I would like to ask if there are any other alternatives, aside from DocumentViewer, for displaying an XPS document in a WPF application? A ready-to-use control or class in .NET if possible.
This is because DocumentViewer is a little slow when you are scrolling through the pages.
Thanks!
No, unless there are any third-party controls that I'm unaware of.
Use NiXPS to convert your XPS document to PDF and use any PDF viewer for WPF out there. This way you will get better performance than you do with DocumentViewer.

Resources