using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using BPASmartClient.Helper; using Microsoft.Toolkit.Mvvm.ComponentModel; using System.Collections.ObjectModel; using Microsoft.Toolkit.Mvvm.Input; namespace WPFDemo { public class Class1 : ObservableObject { public Class1() { AddCommand = new RelayCommand(() => { dataTests.Add(new DataTest() { data1 = new Random().Next(0, 100), data2 = new Random().Next(200, 300), data3 = new Random().Next(400, 500).ToString(), data4 = Convert.ToBoolean(new Random().Next(0, 1)), data5 = new Random().Next(600, 700) }); }); } public ObservableCollection dataTests { get; set; } = new ObservableCollection(); public RelayCommand AddCommand { get; set; } } }