Beispiel #1
0
 public ViewModel()
 {
     _code = new RBGCode {
         R = 0, B = 0, G = 0
     };
     _code.PropertyChanged += (sender, args) = OnPropertyChanged("Code");
 }
        public MainWindow()
        {
            InitializeComponent();

            _rbg = new RBGCode {
                R = 0, G = 0, B = 0
            };

            //Sen sätta Datacontext till det
            //Cill nu binda
            //Vill binda txbox4 till hela objektet och inte bara r (binder deriekt till det som är satt i datacontext och inte bara en properrty)

            //DataContext = _rbg;
            //måste också då byta binding i coden från R till Code.R
            DataContext = new ViewModel();
        }