using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace sfDoubleTextBox
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        TestClassModel model;
        public MainWindow()
        {
            InitializeComponent();
            model = new TestClassModel();
            DataContext = model;
        }


        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            model.TestValue1 = 456.789m;
        }

        private void Button_Click_2(object sender, RoutedEventArgs e)
        {
            model.TestValue2 = 123m;
        }

        private void Button_Click_3(object sender, RoutedEventArgs e)
        {
            model.TestValue1 = 123m;
        }

        private void Button_Click_4(object sender, RoutedEventArgs e)
        {
            model.TestValue2 = 456.789m;
        }
    }

    public class TestClassModel : INotifyPropertyChanged
    {
        public event PropertyChangedEventHandler PropertyChanged;

        protected void OnPropertyChanged([CallerMemberName] string propertyName = null)
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
            }
        }

        private decimal _testValue1;
        public decimal TestValue1
        {
            get => _testValue1;
            set
            {
                if (_testValue1 != value)
                {
                    _testValue1 = value;
                    OnPropertyChanged();
                }
            }
        }

        private decimal _testValue2;
        public decimal TestValue2
        {
            get => _testValue2;
            set
            {
                if (_testValue2 != value)
                {
                    _testValue2 = value;
                    OnPropertyChanged();
                }
            }
        }

        public TestClassModel()
        {
            TestValue1 = 123m;
            TestValue2 = 456.789m;
        }

    }

   



}
