Dynamically placing Windows

Aug 17, 2009 at 2:57 PM

Tim, I'm tring to dynmaically create several windows and place them on the page....

List<FloatableWindow> fl = new List<FloatableWindow>();
fl.Add(GetWindow("one"));
fl.Add(GetWindow("two"));
fl.Add(GetWindow("three"));
BindControls(cds);

Bind Controls lays out the windows side by side using defined width / heights...
similar to

 public void BindControls(List<FloatableWindow> wins)
        {
            foreach (var fw in wins)
            {
               
                fw.Width = cd.Width;
                fw.Height = cd.Height;
                Canvas.SetTop(fw, cd.Y);
                Canvas.SetLeft(w, cd.X); 
               SilverlightDesktopLayoutRoot.Children.Add(fw); 
                }
        }
Whats really annoying for me is the windows display side by side but when I sert the top e.g. Canvas.SetTop(fw, cd.Y); it apprears not to be using the root canvas.... Any ideas?

Aug 17, 2009 at 5:28 PM

Scott - are you setting the ParentLayoutRoot property?

Aug 18, 2009 at 10:41 AM

Perfect Tim -- Exacltly what I need. I downloaded the latest version first .... not sure where i got the version yesterday. I'll post my working code up later on..... its brilliant thanks.