====== jSwitch ====== The [[https://api.comfiletech.com/csharp/api/ComfileTech.jControlsNF4.jSwitch.html|jSwitch]] control implements a sliding switch that can toggle between an on and off state. It has a rich appearance, employing jControls NF4's [[jcontrols_nf4:fills_and_borders:index|fill, border]], [[jcontrols_nf4:shape_and_cornerradii:index|shape, corner radii]], [[jcontrols_nf4:gloss_and_dropshadow:index#dropshadow_property|drop shadow]], and [[jcontrols_nf4:text_features:index|text features]]. ===== Group Property ===== The [[https://api.comfiletech.com/csharp/api/ComfileTech.jControlsNF4.jGroupOnOffControl-1.Group.html#ComfileTech_jControlsNF4_jGroupOnOffControl_1_Group|Group]] property places the control into a mutually exclusive group. In the video below ''jSwitch1'', ''2'', and ''3'' are placed into one group, while ''jSwitch4'', ''5'', and ''6'' are placed into another group. {{ jswitch_group.mp4?900x547 }} Group names are visible application-wide, so please be sure each group name is unique across the entire application. ===== IsOn Property ===== The [[https://api.comfiletech.com/csharp/api/ComfileTech.jControlsNF4.jSwitch.IsOn.html#ComfileTech_jControlsNF4_jSwitch_IsOn|IsOn]] property changes the switch's state to either on (''true'') or off (''false''), and correspondingly the position of the thumb. |{{jswitch_off.png}}|{{jswitch_off_properties.png}}| |{{jswitch_on.png}}|{{jswitch_on_properties.png}}| ===== IsOnChanged Event ===== The [[https://api.comfiletech.com/csharp/api/ComfileTech.jControlsNF4.jSwitch.IsOnChanged.html|IsOnChanged]] event fires any time the [[#ison_property|IsOn]] property changes, and can therefore be used to respond to the operator toggling the switch. ===== OnAppearance and OffAppearance Properties ===== The [[https://api.comfiletech.com/csharp/api/ComfileTech.jControlsNF4.jSwitch.OnAppearance.html#ComfileTech_jControlsNF4_jSwitch_OnAppearance|OnAppearance]] and [[https://api.comfiletech.com/csharp/api/ComfileTech.jControlsNF4.jSwitch.OffAppearance.html#ComfileTech_jControlsNF4_jSwitch_OffAppearance|OffAppearance]] properties describe the appearance of the control when it is in the on state and off state respectively. Each have two properties, Thumb and Track, which are described below. ==== Thumb Property ==== The [[https://api.comfiletech.com/csharp/api/ComfileTech.jControlsNF4.SwitchAppearance.Thumb.html#ComfileTech_jControlsNF4_SwitchAppearance_Thumb|Thumb]] property describes the appearance of the handle that the operate uses to slide the switch back and for between its states. | {{jswitch_thumb.png}} | {{jswitch_thumb_properties.png}} | ==== Track Property ==== The [[https://api.comfiletech.com/csharp/api/ComfileTech.jControlsNF4.SwitchAppearance.Track.html|Track]] property is used to describe the appearance of the control's track that the thumb slides along. | {{jswitch_track.png}} | {{jswitch_track_properties.png}} | ===== Text Property ===== The ''Text'' property is a [[https://msdn.microsoft.com/en-us/library/system.string.format%28v=vs.110%29.aspx|.NET format string]], that utilizes the [[https://learn.microsoft.com/en-us/dotnet/standard/base-types/custom-numeric-format-strings#the--section-separator|section operator]], to specify the text to display on the thumb. The only argument, ''{0}'', is the value of the [[#ison_property|IsOn]] property. | {{jswitch_off.png}} | {{jswitch_text_on_off.png}} | | {{jswitch_on.png}} | ::: | | {{jswitch_no.png}} | {{jswitch_text_yes_no.png}} | | {{jswitch_yes.png}} | ::: |