title | description | page_title | type | slug | position | tags | res_type | ticketid |
---|---|---|---|---|---|---|---|---|
Customize the RadToggleSwitchButton to Display Content when the IsChecked property is null |
This article will show you how to display content when the RadToggleSwitchButton's IsChecked property is null. |
Display Content When RadToggleSwitchButton's IsChecked property is null |
how-to |
kb-buttons-toggleswitchbutton-three-state-content |
0 |
buttons, toggleswitchbutton, three state, tri-state, undefined, content, state |
kb |
1649117 |
Product Version | 2024.1.423 |
Product | RadButtons for WPF |
[Extract the default control template]({%slug styling-apperance-editing-control-templates%}#extracting-control-templates-manually-from-the-theme-xaml-file) of RadToggleSwitchButton
and include an additional ContentPresenter
element. This ContentPresenter will use the values set to the Content
and ContentTemplate
properties of RadToggleSwitchButton. You can use these properties to set your content when the control's IsChecked is set to null.
The following example shows the modified control template of the RadToggleSwitchButton control for the Windows 11 theme.
[XAML] Modifying the default control template of RadToggleSwitchButton to display content when it is in an undefined state
{{region kb-buttons-toggleswitchbutton-three-state-content-0}} <Application.Resources> <ResourceDictionary.MergedDictionaries> </ResourceDictionary.MergedDictionaries> <Style x:Key="CustomToggleSwitchButtonStyle" TargetType="telerik:RadToggleSwitchButton" BasedOn="{StaticResource RadToggleSwitchButtonStyle}"> <Setter.Value> <Grid.ColumnDefinitions> </Grid.ColumnDefinitions> <Ellipse.RenderTransform> </Ellipse.RenderTransform> <ControlTemplate.Triggers> <MultiTrigger.Conditions> </MultiTrigger.Conditions> <MultiDataTrigger.Conditions> <Condition.Binding> </Condition.Binding> </MultiDataTrigger.Conditions> <MultiDataTrigger.Conditions> <Condition.Binding> </Condition.Binding> </MultiDataTrigger.Conditions> <Trigger.EnterActions> </Trigger.EnterActions> <Trigger.ExitActions> </Trigger.ExitActions> <Trigger.EnterActions> </Trigger.EnterActions> <Trigger.ExitActions> </Trigger.ExitActions> <MultiDataTrigger.Conditions> <Condition.Binding> </Condition.Binding> </MultiDataTrigger.Conditions> <MultiDataTrigger.Conditions> <Condition.Binding> </Condition.Binding> </MultiDataTrigger.Conditions> <MultiDataTrigger.Conditions> <Condition.Binding> </Condition.Binding> </MultiDataTrigger.Conditions> </ControlTemplate.Triggers> </Setter.Value> </Style> </Application.Resources> {{endregion}}
{{region kb-buttons-toggleswitchbutton-three-state-content-1}} <telerik:RadToggleSwitchButton IsThreeState="True"> telerik:RadToggleSwitchButton.Style <Style TargetType="telerik:RadToggleSwitchButton" BasedOn="{StaticResource CustomToggleSwitchButtonStyle}"> <Style.Triggers> <Setter.Value> </Setter.Value> </Style.Triggers> </Style> </telerik:RadToggleSwitchButton.Style> </telerik:RadToggleSwitchButton> {{endregion}}
RadToggleSwichButton with content when the IsChecked property is null