Extending a UserControl in Silverlight

In a current project that I’m working on, I needed to extend a UserControl to add some additional specialized functionality. This is very easy to do if all you need is to extend code, but it becomes much more difficult if you want to extend it via a XAML/C# UserControl. After much web searching, I found a very simple and elegant solution, thanks to this site. Basically, all you have to do is modify the root element of your extended file as follows:

<local:SomeBaseTypeYouWantToUse
    x:Class="MyApp.MyControl"
    xmlns:local="clr-namespace:NameSpace.To.Your.BaseClass"
/>

Where SomeBaseTypeYouWantToUse is the class that you’d like to extend. Simple!

–Adam

Update (6/3/2010):I ran into some weird problems with this hack that I was unable to resolve. If anyone ends up reading this, please let me know if this worked correctly for your application.

PHP 5.3 and MySQL: A connection attempt failed because the connected party did not properly respond after a period of time…

Having difficulty connecting to MySQL through PHP 5.3.x? Know that MySQL and PHP are properly configured? Using Windows Vista / 7? The problem may very well be that you’re connecting to ‘localhost.’ According to Joe Bedan, simply changing ‘localhost’ to ‘127.0.0.7’ will fix the problem, and he’s right!

According to another forum post, this is because Vista/7 does some goofy stuff with the ‘localhost’ alias. This person suggests that modifying the C:\Windows\System32\drivers\etc\hosts file to contain the line ‘127.0.0.1 localhost’ will fix the problem (make sure to do this as an administrator!). Unfortunately, this wasn’t the case for me. However, it’s worth a shot for anyone experiencing this problem.


–Adam