Windows Vista Forums
Vista Forums Home Join Vista Forums Donate Vista Tutorials Tags

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.
Register at Vista forums...the world biggest Windows Vista resource Join Vista Forums Now

Go Back   Vista Forums > Microsoft Technical Newsgroups > Avalon

Loading an XAML file into a DrawingVisual

Closed Thread
 
Thread Tools Display Modes
Old 06-13-2006   #1 (permalink)
John Dunn
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
Old 06-21-2006   #2 (permalink)
Adam Smith [MS]
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



Old 06-21-2006   #3 (permalink)
John Dunn
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

>
>
>

Old 06-22-2006   #4 (permalink)
Adam Smith [MS]
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

>>
>>
>>



Closed Thread

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








Vistax64.com is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media 2005-2008

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50