public void Generate(int number) { ObservableCollection <Sticks> tempo = new ObservableCollection <Sticks>(); ObservableCollection <Sticks> alphatempo = new ObservableCollection <Sticks>(); ObservableCollection <Sticks> betatempo = new ObservableCollection <Sticks>(); first.Clear(); third.Clear(); second.Clear(); ALPHAfirst.Clear(); ALPHAsecond.Clear(); ALPHAthird.Clear(); BETAfirst.Clear(); BETAsecond.Clear(); BETAthird.Clear(); Procedure.Clear(); BackProcedure.Clear(); Steps = ""; if (pegname == "A" || pegname == "a") { pegname = "A"; tempo = first; alphatempo = ALPHAfirst; betatempo = BETAfirst; } if (pegname == "B" || pegname == "b") { pegname = "B"; tempo = second; alphatempo = ALPHAsecond; betatempo = BETAsecond; } if (pegname == "C" || pegname == "c") { pegname = "C"; tempo = third; alphatempo = ALPHAthird; betatempo = BETAthird; } for (int i = number; i > 0; i--) { var b = new Sticks(i.ToString()); tempo.Insert(0, new Sticks(i.ToString())); alphatempo.Insert(0, new Sticks(i.ToString())); betatempo.Insert(0, new Sticks(i.ToString())); } StepByStepFlag = false; }