Problem with IsChecked databinding?

Thread is closed for posting
2 posts, 0 answers
  1. Martin
    Martin avatar
    8 posts
    Member since:
    Oct 2011

    Posted 22 May 2012 Link to this post

    Hi, I got problem with binding IsChecked property to my bool property in ViewModel, it looks like changes in viewModel are not propagated to ToggleSwitch, or am I missing something?

    in MainPage.xaml

    <ToggleSwitch:ToggleSwitchButton IsChecked="{Binding Toggle, Mode=TwoWay}"/>
    <Button Content="Button" Click="Button_Click"/>
    <TextBlock TextWrapping="Wrap" Text="{Binding Toggle}"/>
    private void Button_Click(object sender, System.Windows.RoutedEventArgs e)
        MainViewModel model = ServiceLocator.Current.GetInstance<MainViewModel>();
        model.Toggle = !model.Toggle;
    in ViewModel:   
    public bool Toggle
        get { return toggle; }
            if (toggle == value) return;
            toggle = value;
            RaisePropertyChanged(() => Toggle);
    private bool toggle;

    the text in textbox is updating, but Toggle is still Off - any hint? 

    Note: we use currently intermediate build 2012.2.518.2040

  2. Todor
    Todor avatar
    798 posts

    Posted 23 May 2012 Link to this post

    Hello Martin,

    Thank you for your interest in RadToggleSwitch.

    The control that you need is called RadToggleSwitch and it is part of the Telerik.Windows.Controls namespace. This is described in our online documentation. You have added only a ToggleSwitchButton which is only one of the visual parts of the control and it does not include all the logic that is necessary to make it work. If you want to see only the ToggleSwitchButton, without the text that comes with it in the default look of the control, you can set the Content property to {x: Null}.

    I hope this information helps. If you need additional assistance, we will be happy to help.

    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Back to Top