private void UserControl_Loaded(object sender, RoutedEventArgs e) { if (ConditionCals.Count == 0) { ConditionCals.Add(new ConditionCal()); } }
private void BtnAdd_OnClick(object sender, RoutedEventArgs e) { ConditionCal item0 = new ConditionCal(); List <ConditionCal> cons = new List <ConditionCal>(ConditionCals.ToArray()); cons.Add(item0); ConditionCals = cons; //gridTagItems.SelectedItem = ConditionCals[ConditionCals.Count - 1]; }
private void BtnDel_OnClick(object sender, RoutedEventArgs e) { List <ConditionCal> cons = new List <ConditionCal>(ConditionCals.ToArray()); ConditionCal item0 = gridTagItems.SelectedItem as ConditionCal; if (item0 != null) { cons.Remove(item0); } if (cons.Count == 0) { cons.Add(new ConditionCal()); } ConditionCals = cons; }