![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
|
Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
br> br> |
| |||||||
![]() |
| | Thread Tools | Display Modes |
| | #1 (permalink) |
| Guest | Loading an XAML file into a DrawingVisual Is it possible to load an XAML file and then put the contents of that file into a DrawingVisual? I'm playing around with making some graphic objects with the Expression Graphic Designer and can load them with the XamlReader object. The Object I get back is a Canvas which if you trace down far enough you get to a Visual Object. Unfortunately I don't see a way to 'blit' this Visual into a DrawingVisual object. Is there a way to do this? Thanks- John |
| | #2 (permalink) |
| Guest | Re: Loading an XAML file into a DrawingVisual Consider using Drawings instead - you can use EID to produce Drawings instead of an Element tree (I'm afraid I don't have it in front of me to check precisely how, you may need to convert it to a DrawingBrush). You can then take the Drawing from the XamlReader and do: DrawingVisual vis; .... DrawingContext ctx = vis.RenderOpen(); ctx.DrawDrawing(myDrawing); ctx.Close(); -Adam Smith [MS] "John Dunn" <JohnDunn@discussions.microsoft.com> wrote in message news:B986FED8-DA84-45F7-B77D-C22FD9CBE8F9@microsoft.com... > Is it possible to load an XAML file and then put the contents of that file > into a DrawingVisual? I'm playing around with making some graphic objects > with the Expression Graphic Designer and can load them with the XamlReader > object. The Object I get back is a Canvas which if you trace down far > enough > you get to a Visual Object. Unfortunately I don't see a way to 'blit' this > Visual into a DrawingVisual object. Is there a way to do this? > > Thanks- > > John |
| | #3 (permalink) |
| Guest | Re: Loading an XAML file into a DrawingVisual Thanks, that did the trick. I was able to import the resource dictionary and pull the DrawingImage out of that. The only issue is that I loose all of my effects ( shadows, etc ). I'm guessing that's a limitation of the resource dictionary. "Adam Smith [MS]" wrote: > Consider using Drawings instead - you can use EID to produce Drawings > instead of an Element tree (I'm afraid I don't have it in front of me to > check precisely how, you may need to convert it to a DrawingBrush). You can > then take the Drawing from the XamlReader and do: > > DrawingVisual vis; > .... > DrawingContext ctx = vis.RenderOpen(); > ctx.DrawDrawing(myDrawing); > ctx.Close(); > > -Adam Smith [MS] > > "John Dunn" <JohnDunn@discussions.microsoft.com> wrote in message > news:B986FED8-DA84-45F7-B77D-C22FD9CBE8F9@microsoft.com... > > Is it possible to load an XAML file and then put the contents of that file > > into a DrawingVisual? I'm playing around with making some graphic objects > > with the Expression Graphic Designer and can load them with the XamlReader > > object. The Object I get back is a Canvas which if you trace down far > > enough > > you get to a Visual Object. Unfortunately I don't see a way to 'blit' this > > Visual into a DrawingVisual object. Is there a way to do this? > > > > Thanks- > > > > John > > > |
| | #4 (permalink) |
| Guest | Re: Loading an XAML file into a DrawingVisual Hrm... that depends on how you were creating those effects. If you were using BitmapEffects to create shadows, etc, you can still use those in a graph of Drawings (DrawingGroup has a BitmapEffect property) - it may be that EID doesn't preserve them when doing the conversion. If you were not using BitmapEffects, what technique were you using? -Adam Smith [MS] "John Dunn" <JohnDunn@discussions.microsoft.com> wrote in message news:169D5D23-0760-4ADF-A5A2-DFF5E52C205C@microsoft.com... > Thanks, that did the trick. I was able to import the resource dictionary > and > pull the DrawingImage out of that. The only issue is that I loose all of > my > effects ( shadows, etc ). I'm guessing that's a limitation of the resource > dictionary. > > > "Adam Smith [MS]" wrote: > >> Consider using Drawings instead - you can use EID to produce Drawings >> instead of an Element tree (I'm afraid I don't have it in front of me to >> check precisely how, you may need to convert it to a DrawingBrush). You >> can >> then take the Drawing from the XamlReader and do: >> >> DrawingVisual vis; >> .... >> DrawingContext ctx = vis.RenderOpen(); >> ctx.DrawDrawing(myDrawing); >> ctx.Close(); >> >> -Adam Smith [MS] >> >> "John Dunn" <JohnDunn@discussions.microsoft.com> wrote in message >> news:B986FED8-DA84-45F7-B77D-C22FD9CBE8F9@microsoft.com... >> > Is it possible to load an XAML file and then put the contents of that >> > file >> > into a DrawingVisual? I'm playing around with making some graphic >> > objects >> > with the Expression Graphic Designer and can load them with the >> > XamlReader >> > object. The Object I get back is a Canvas which if you trace down far >> > enough >> > you get to a Visual Object. Unfortunately I don't see a way to 'blit' >> > this >> > Visual into a DrawingVisual object. Is there a way to do this? >> > >> > Thanks- >> > >> > John >> >> >> |
| |
| |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Is it possible to include XAML files into another XAML file? | star-italia | .NET General | 6 | 06-12-2008 04:56 AM |
| dynamic loading xaml | Dave | Avalon | 0 | 11-27-2007 02:58 PM |
| Loading a XAML File Containing Controls | Bree | Avalon | 2 | 12-07-2006 08:55 AM |
| How to deploy an XAML-based App with its XAML-UI-File? | Solveigh | Avalon | 11 | 11-08-2006 07:50 AM |
| File.xaml and File.xaml.cs are atomically checked out/in from sourcesafe | Pascal Bourque | Avalon | 1 | 04-26-2006 06:47 PM |