Can Windows Presentation Foundation read/write WMF/EMF files without having to use WinForms Interop or Win32.
If it does not, what is the reason?
A quick search on MSDN reveals a thread containing a post by Peggi Goodwin, a PM at Microsoft:
WPF does not support the EMF and WMF image formats. These formats are more susceptible to security vulnerabilities than other image formats, so we do not intend to support them.
I did it !!!
I'm using ComponentOne's WPF chart in my real code but to keep the example simple I just did a button. But it DOES work on Complex wpf widgets. Fonts, Transparency, AntiAlias etc. everything works. And I can paste into Word and change labels on charts etc.
Basically I decimate the XAML to XPS then import it back into XAML.
Then I used an open source project that converts XAML to WMF called XAMLToys.
XAMLToys would fail 99% of the time because you cannot serial complex XAML objects
http://softronix.com/download/WpfToWmfClipboard.zip
Big kudos to these two projects
http://xamltoys.codeplex.com/
http://khason.net/blog/converting-fixeddocument-xpsdocument-too-to-flowdocument/
Related
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.
As per the title, what's the preferred image format (or formats) for use in WPF?
My company will hire a designer to design some logos, images, toolbar icons, etc. for use in a WPF application. I was going to ask for Vector Graphics as they are supposed to stretch, shrink, etc without loosing clarity;
However, reading this post
Does WPF support reading/writing WMF/EMF files natively?
and others has got me worried; IT DOES NOT SEEM LIKE A SIMPLE TASK?! isn't this what WPF is supposed to handle natively in its sleep ?! stretch, rotate, throw flames, make toast, etc...
The preferred vector image format is XAML. There are a lot of ways for a designer to generate those graphics. Adoble Illustrator for example can use the XAML exporter. The open source tool Inkscape can export to XAML directly, a designer can also draw XAML using Microsoft Expression Design and Microsoft Expression Blend. Literally all vector graphics tool support SVG and there are a lot of ways to convert SVG to XAML.
Don't bother with WMF/EMF it will just look ugly since windows can not render them antialiased.
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.
As I started using WPF at higher DPI resolutions, I got into troubles with scaling of toolbar images. XAML images solve that problem.
However I find it very hard to find free toolbar/ribbon XAML images that you can use in your own projects. What I found is usually not free and one probably needs more than few collections to get all needed images.
Where do you find your toolbar/ribbon .xaml images?
Check out the following link
Hidden features of WPF and XAML?
There is a list of converters that can take many formats of images and convert them to xaml for you.
Personally, I wind up using InkScape to create my XAML a lot. Even with my meager drawing skills, it's fairly easy to use and very effective.
As a note, though, I tend to work with the image in the native format and then save as XAML. Working with a file in XAML format seems to be somewhat unstable.
I was putting finishing touches on a new WPF/Silverlight custom control and decided that this time I would go with .NET 3.5 SP1 requirement (for WPF version). So, I decided to go with recommended new way of setting toolbox icon/image with ThumbnailAttribute. After spending some time on it I couldn't make it work and turned for help to Google.
Surprisingly a search for ThumbnailAttribute produces basically no results on Google. There's MSDN documentation of the class, a few irrelevant hits and 2 articles (one of which is mine) showing how to do it the old way and just mentioning that there's a new way with ThumbnailAttribute.
So, my question is this: does anybody use ThumbnailAttribute to set toolbox images for WPF/Silverlight controls? Does it work?
Update: Microsoft recommends using specifically named icon files rather than ThumbnailAttribute as per Michael S. Scherotter (see comment below).
You want to create a design-time assembly for your class. You do this to assign design-time attributes to a class that don't take up space in the assembly. This is important for Silverlight apps which should have smaller assemblyies for faster downloading.
See this article for an description of the design-time assembly.
For Icons, in the design-time assembly add 12x12 and 24x24 PNG icons as embedded resources with these names:
Namespace.ControlName.12x12.png
Namespace.ControlName.24x24.png