![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
| |
| | #1 (permalink) |
| | 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 |
My System Specs![]() |
| | #2 (permalink) |
| | 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 |
My System Specs![]() |
| | #3 (permalink) |
| | 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 > > > |
My System Specs![]() |
| | #4 (permalink) |
| | 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 >> >> >> |
My System Specs![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Is it possible to include XAML files into another XAML file? | .NET General | |||