IPhone (like) switch button in Silverlight
On a project I had the intention of using an IPhone-like switch button for setting a confidential flag in the UI. After some research on the internet I haven’t found an usable solution…
I spend some time to design a switch button in XAML, the switch button is based on a classical checkbox control: if the switch button has the 0 value, the control has the unselected state, if the button has the 1 value, the control has the selected state.
A preview:
You can change the color in the Generic.xaml by replacing the following XAML with your own brush:
<!--Checked rectangle brush
YOU CAN CHANGE IT IN YOUR PREFERED GRADIENT-->
<Rectangle.Fill>
<LinearGradientBrush EndPoint="0,0"
StartPoint="0,1">
<GradientStop Offset="0"
Color="#D8D8D8" />
<GradientStop Offset="0.5"
Color="#C6C6C6" />
<GradientStop Offset="0.5"
Color="#D8D8D8" />
<GradientStop Offset="1"
Color="White" />
<GradientStop Color="#FFBCC1BE"
Offset="0.5" />
</LinearGradientBrush>
</Rectangle.Fill>
I posted a LightSwitch version of your control here:
http://lightswitchhelpwebsite.com/Blog/tabid/61/EntryId/49/How-To-Create-a-Simple-Control-Extension-Or-How-To-Make-LightSwitch-Controls-You-Can-Sell.aspx