private void addTask_MouseDown(object sender, MouseButtonEventArgs e) { // 產生 price price = new price(); //放到清單 TaskList.Children.Add(price); int sum = 0; foreach (price item in TaskList.Children) { sum += int.Parse(item.TaskPrice.Text); totalPrice.Text = sum.ToString(); } }
private void Window_Loaded(object sender, RoutedEventArgs e) { string[] lines = System.IO.File.ReadAllLines(@"C:\data.txt"); foreach (string line in lines) { string[] parts = line.Split('|'); price price = new price(); price.date.Text = parts[0]; price.TaskName.Text = parts[1]; price.TaskPrice.Text = parts[2]; TaskList.Children.Add(price); } }
private void addTask_MouseDown(object sender, MouseButtonEventArgs e) { price price = new price(); TaskList.Children.Add(price); }