Silverlight Quick Tip: How to resize window from Silverlight

April 26, 2009

One of my colleagues asked me if it is possible to resize the Browser Window from within Silverlight application. Well, my answer was: “everything what is possible to do from JavaScript is possible to do from Silverlight”. Here is sample code how to do it in case someone else is also looking for the solution: if (HtmlPage.BrowserInformation.UserAgent.ToLower().IndexOf("chrome") < 0) { HtmlPage.Window.Invoke("moveTo", new object { 100, 100 }); HtmlPage.Window.Invoke("resizeTo", new object { 250, 250 }); } //else // MessageBox.Show("Why bother? Chrome will not accept this anyway ;)"); * this will not work on Google Chrome probably because of some...

What’s new in Silverlight 3 at WDC (03 May 2009)

April 25, 2009

Silverlight 3 is long awaited upgrade for the current version of Silverlight. Many new features were added, many improvements were made. Come and see me presenting what’s new in Silverlight 3 Beta 1 at Web Developers Community (also known as WDC) next Sunday (03-May-2009) at Microsoft Israel Offices. I will talk about current version of Silverlight (a little bit), new features and available tools. Expect cool demos and live coding as usual :) Details and Registration   See you there, Alex

Silverlight 3 Quick Tip #7: System Colors

April 12, 2009

Silverlight 3 now supports operating system colors. This means, that now Silverlight 3 applications could be adopted for users who use high-contrast color schemes. The usage is very simple – in System.Windows namespace exists new static class “SystemColors” with colors definitions. Those colors could be use as a Color in any brushes. The sample code is very short this time: Rectangle activeBorderColor = new Rectangle(); activeBorderColor.Fill = new SolidColorBrush(System.Windows.SystemColors.ActiveBorderColor);   Here is sample application running standard Vista Aero color scheme: after changing color scheme to high-contrast the same applications looks like follows:       Enjoy, Alex

Silverlight 3 Quick Tip #6: Navigation Framework and Uri Routing

April 2, 2009

Silverlight 3 introduced the Navigation Framework and URI Routing features. Today I’ll show how to use those features. To use navigation features you could either create a new “Silverlight Navigation Application” or simply add relevant references to standard “Silverlight application” In case of standard “Silverlight Application” you need to add reference to “System.Windows.Controls.Navigation” assembly and relevant XAML introduce namespace: xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation" To use the navigation feature, simply add new Frame to your XAML page. Frame could have default content, specify Journal usage (own history storage or integration within browser’s history), raise navigation related events. <navigation:Frame x:Name="frame" Source="/Pages/DefaultPage.xaml" ...