<commit_before>﻿// Copyright (c) The Perspex Project. All rights reserved.
// Licensed under the MIT license. See licence.md file in the project root for full license information.

using System;
using Perspex.Interactivity;
using Perspex.Data;

namespace Perspex.Controls.Primitives
{
    public class ToggleButton : Button
    {
        public static readonly DirectProperty<ToggleButton, bool> IsCheckedProperty =
            PerspexProperty.RegisterDirect<ToggleButton, bool>(
                "IsChecked",
                o => o.IsChecked,
                (o,v) => o.IsChecked = v,
                defaultBindingMode: BindingMode.TwoWay);

        private bool _isChecked;

        static ToggleButton()
        {
            PseudoClass(IsCheckedProperty, ":checked");
        }

        public bool IsChecked
        {
            get { return _isChecked; }
            set { SetAndRaise(IsCheckedProperty, ref _isChecked, value); }
        }

        protected override void OnClick(RoutedEventArgs e)
        {
            Toggle();
        }

        protected virtual void Toggle()
        {
            IsChecked = !IsChecked;
        }<commit_msg>Call ToggleButton OnClick base method<commit_after>﻿// Copyright (c) The Perspex Project. All rights reserved.
// Licensed under the MIT license. See licence.md file in the project root for full license information.

using System;
using Perspex.Interactivity;
using Perspex.Data;

namespace Perspex.Controls.Primitives
{
    public class ToggleButton : Button
    {
        public static readonly DirectProperty<ToggleButton, bool> IsCheckedProperty =
            PerspexProperty.RegisterDirect<ToggleButton, bool>(
                "IsChecked",
                o => o.IsChecked,
                (o,v) => o.IsChecked = v,
                defaultBindingMode: BindingMode.TwoWay);

        private bool _isChecked;

        static ToggleButton()
        {
            PseudoClass(IsCheckedProperty, ":checked");
        }

        public bool IsChecked
        {
            get { return _isChecked; }
            set { SetAndRaise(IsCheckedProperty, ref _isChecked, value); }
        }

        protected override void OnClick(RoutedEventArgs e)
        {
            base.OnClick(e);
            Toggle();
        }

        protected virtual void Toggle()
        {
            IsChecked = !IsChecked;
        }
{'fraction_non_alphanumeric': 0.07851414098775855, 'fraction_numerical': 0.0, 'mean_word_length': 2.0191082802547773, 'pattern_counts': {'":': 2, '<': 7, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6073532', 'n_tokens_mistral': 629, 'n_tokens_neox': 585, 'n_words': 171}