private void SetList_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e) { IndividualRummySetWPF <SU, CO, RU, GC, GW, SE, T> thisTemp; if (e.Action == NotifyCollectionChangedAction.Remove) { if (e.OldItems.Count != 1) { throw new BasicBlankException("Cannot remove one item at a time"); } _thisStack !.Children.RemoveAt(e.OldStartingIndex); return; } if (e.Action == NotifyCollectionChangedAction.Reset) { _thisStack !.Children.Clear(); //this is it. } if (e.Action == NotifyCollectionChangedAction.Add) { foreach (var thisItem in e.NewItems) { var thisSet = (SE)thisItem !; thisTemp = new IndividualRummySetWPF <SU, CO, RU, GC, GW, SE, T>(); thisTemp.Divider = Divider; thisTemp.Additionals = Additionals; thisTemp.LoadList(thisSet, _tagUsed); _thisStack !.Children.Add(thisTemp); } } }
public void Update(MainSetsObservable <SU, CO, RU, SE, T> thisMod) { _thisStack !.Children.Clear(); _setList !.CollectionChanged -= SetList_CollectionChanged; _setList = thisMod.SetList; _setList.CollectionChanged += SetList_CollectionChanged; foreach (var thisSet in thisMod.SetList) { var thisTemp = new IndividualRummySetWPF <SU, CO, RU, GC, GW, SE, T>(); thisTemp.Divider = Divider; thisTemp.Additionals = Additionals; thisTemp.LoadList(thisSet, _tagUsed); _thisStack.Children.Add(thisTemp); } }
public void Init(MainSetsObservable <SU, CO, RU, SE, T> thisMod, string tagUsed) { _tagUsed = tagUsed; _thisStack = new StackPanel(); _thisStack.Orientation = Orientation.Horizontal; IndividualRummySetWPF <SU, CO, RU, GC, GW, SE, T> thisTemp; Grid firstGrid = new Grid(); ScrollViewer thisScroll = new ScrollViewer(); thisScroll.HorizontalScrollBarVisibility = ScrollBarVisibility.Auto; thisScroll.VerticalScrollBarVisibility = ScrollBarVisibility.Auto; if (thisMod.HasFrame == true) { Text = thisMod.Text; var thisRect = ThisFrame.GetControlArea(); thisScroll.Margin = new Thickness((double)thisRect.Left + (float)3, (double)thisRect.Top + (float)3, 3, 5); // try this way. firstGrid.Children.Add(ThisDraw); firstGrid.Children.Add(thisScroll); } else { firstGrid.Children.Add(thisScroll);// this alone. } _setList = thisMod.SetList; foreach (var thisSet in thisMod.SetList) { thisTemp = new IndividualRummySetWPF <SU, CO, RU, GC, GW, SE, T>(); thisTemp.Divider = Divider; thisTemp.Additionals = Additionals; thisTemp.LoadList(thisSet, tagUsed); _thisStack.Children.Add(thisTemp); } _setList.CollectionChanged += SetList_CollectionChanged; thisScroll.Content = _thisStack; Content = firstGrid; }