SelectSwitch Control

This control is used to show a toggling button that shows a 'indicator' to indicate enabling and an optional piece of text to indicate the choice. The control is meant to be a replacement for ToggleSwitch which users tend to want to swipe instead of tap. This is especially problematic on Pivots or Panoramas. You can see the control here:

selectswitch.jpg

You can see the XAML here where the IsSelected property is the boolean value of whether the control is enabled or not. It is a ContentControl so what is on the right is inside the control:


<my:SelectSwitch IsSelected="{Binding SomeBoolean, Mode=TwoWay}"
                  x:Name="theSwitch">
  <TextBlock Text="This is the content of my SelectSwitch control"
              FontSize="24"
              TextWrapping="Wrap"
              FontWeight="Bold"
              Margin="8" />
</my:SelectSwitch>

You can control what the text is on the control with individual attributes as well as what brushes are used for the text or the 'indicator':


<my:SelectSwitch IsSelected="{Binding SomeBoolean, Mode=TwoWay}"
                  SelectedText="Is Enabled"
                  UnSelectedText="Not Enabled"
                  TextIndicatorFontFamily="Comic Sans MS"
                  TextIndicatorFontSize="16"
                  TextIndicatorFontWeight="Bold"
                  TextIndicatorFontStretch="UltraExpanded"
                  TextIndicatorBrush="Green"
                  TextIndicatorFontStyle="Italic"
                  IndicatorBrush="Orange">
  <TextBlock Text="This is the content of my SelectSwitch control"
              FontSize="24"
              TextWrapping="Wrap"
              FontWeight="Bold"
              Margin="8" />
</my:SelectSwitch>

Last edited Mar 13, 2011 at 7:03 AM by TheADOGuy, version 3

Comments

No comments yet.