views:

523

answers:

1

Haven't started this one yet but I know I will have to tackle it in the next couple weeks..

I am creating a simple single-line toolbar (a horizontal StackPanel w/buttons) in Silverlight 2 and need to detect when the width of the browser starts colliding with the buttons.

Upon collision I will display an "overflow" indicator which is attached to a dropdown menu and moving the colliding buttons there.

Exactly like the IE toolbars..

Any ideas?

Thanks in advance!

A: 

Something you could try would be wiring up an event in your Silverlight code to the browser's resize event:

void Page_Loaded(object sender, RoutedEventArgs e)
{
  System.Windows.Browser.HtmlPage.Window.AttachEvent("resize", BrowserResized);
}

void BrowserResized(object sender, System.Windows.Browser.HtmlEventArgs e)
{
  //TODO: things
}

I found this link (here) that talks about getting the actual browser size from within Silverlight 2.

There maybe a simpler way, but at first pass, this seems like it could work.

Jonas