I have a Xaml file which is used in a project which can be built for both Silverlight and WPF. I want to use the GridSplitter control. However, this control is in different Xaml namespaces on Silverlight and desktop WPF.
In WPF, the namespace is: http://schemas.microsoft.com/winfx/2006/xaml/presentation
On Silverlight, it is: http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk
So if the xaml code is <GridSplitter/>, it will work on WPF but not Silverlight, and if the code is <sdk:GridSplitter/>, it will work on Silverlight but not WPF.
Is there a way to write this so that it works on both platforms?
What I ended up doing was to create my own class that derived from GridSplitter.
Then I put an xmlns for my project at the top of my xaml file:
And then I could just use the local namespace prefix for my GridSplitter: