Scott Logic

Silverlight ClipToBounds – Can I Clip It?, Yes You Can!

May 12th, 2009
With Silverlight, Panels do not clip their contents by default. See the following example: Where we have a Grid containing another Grid which itself contains an ellipse, and a Canvas which contains an ellipse: <Grid x:Name="LayoutRoot" Background="White"> <Grid.ColumnDefinitions> <ColumnDefinition Width="*"/> [...]

Using CSS Selectors for Styling in WPF

March 11th, 2009
When I first encountered WPF I was really impressed by its styling and templating features which are more powerful than anything else I had previously seen for desktop software development. The property-value pairing within styles instantly reminded me of CSS, however the WPF styles lack the most powerful feature of CSS – the selector. This [...]

Implementing RelativeSource binding in Silverlight

February 27th, 2009
In my previous post I demonstrated how an the WPF ElementName style binding can be emulated with Silverlight via an attached behaviour. As a brief recap, the technique involved creating an attached property, which when bound, adds a handler for the elements Loaded event. When the element is loaded, the even handler locates the named [...]

ElementName binding in Silverlight via Attached Behaviours

February 22nd, 2009
As a relative newcomer to Silverlight I was happily greeted by the warm feeling of familiarity when I started developing. It is surprisingly easy to make the transition from WPF to Silverlight developer, with most of the core concepts being just the same. However, there are some parts of the WPF framework that you start [...]