Mike Taulty's Blog
Bits and Bytes from Microsoft UK
Building a Viewbox-like control

Blogs

Mike Taulty's Blog

Elsewhere

Archives

I found myself reading this post today as I wanted to build a Silverlight control which is a little like Viewbox in that it has ( let’s say ) a single lump of content that it wants to display and I was struggling to find the right base class for it.

Why? Because in WPF there are methods like AddLogicalChild on FrameworkElement whereas in Silverlight you don’t have this so you have to look for a control to sub-class which already has some notion of content ( like ContentControl perhaps :-) ).

Anyway, it’s an interesting read to see how Viewbox had to function a particular way when implemented by the Silverlight Toolkit team and ( if you look at the beta bits for Silverlight 3 ) you’ll find that it now works as you’d expect especially when you write XAML like;

<controls:Viewbox>
            <TextBlock
                x:Name="xyz" />
        </controls:Viewbox>


Posted Tue, Jun 9 2009 2:32 AM by mtaulty
Filed under:

Comments

Dew Drop - June 9, 2009 | Alvin Ashcraft's Morning Dew wrote Dew Drop - June 9, 2009 | Alvin Ashcraft's Morning Dew
on Tue, Jun 9 2009 6:04 AM