Hi,

I have a bunch of questions.. :)  (A couple now, lots later I'm sure!)

1. What approach would folks use if they wanted to put a bunch of images on
a canvas (dynamically), that then moved about (think sprites for a game).

- Currently I have a control, VisualBox that in it's xaml has some
placeholders (eg. {0} {1}) that I populate when performing the load
in the constructor.

System.IO.Stream s = this.GetType().Assembly.GetManifestResourceStream("
Foo.VisualBox.xaml");
string xaml = string.Format(new System.IO.StreamReader(s).ReadToEnd(), x, y,
imagePath);
this.InitializeFromXaml(xaml);

Now, if I want 10 of these 'sprites' on the screen, I am newing up 10
VisualBoxes and adding them to the canvas - canvas.Children.Add(vb1) etc.

This seems a 'heavy handed' way, and I'm wondering if there is a 'lighter'
way to do this.. (perhaps using FrameworkElement directly or something)

Ideas??




2. What is the 'correct' way to completely remove a (or all) elements from
the main canvas (Page)?
I guess I'm trying to make sure that all resources associated with a control
are freed up when I remove that control from the
page.
If I do a canvas.Children.Clear() (and I am not holding any references to to
any children anywhere else), is this enough??

Cheers!

Adam



------------------------------------------------------------------- 
OzSilverlight.com - to unsubscribe from this list, send a message back to the 
list with 'unsubscribe' as the subject.
Powered by mailenable.com - List managed by www.readify.net

Reply via email to