public void LoadList(ScatteringPiecesObservable <CA, LI> mod, string tagUsed) { EventAggregator thisE = Resolve <EventAggregator>(); thisE.Subscribe(this); SetBinding(TextProperty, nameof(ScatteringPiecesObservable <CA, LI> .TextToAppear)); SetBinding(IsEnabledProperty, nameof(ScatteringPiecesObservable <CA, LI> .IsEnabled)); _thisMod = mod; DataContext = _thisMod; // so it can do the text and isenabled. _tagUsed = tagUsed; _objectList = mod.RemainingList; _objectList.CollectionChanged += ObjectList_CollectionChanged; _thisCanvas = new Canvas(); _thisCanvas.Height = _thisMod.MaxSize.Height; _thisCanvas.Width = _thisMod.MaxSize.Width; Grid tirstGrid = new Grid(); tirstGrid.Children.Add(ThisDraw); ScrollViewer thisScroll = new ScrollViewer(); thisScroll.HorizontalScrollBarVisibility = ScrollBarVisibility.Auto; thisScroll.VerticalScrollBarVisibility = ScrollBarVisibility.Auto; thisScroll.Content = _thisCanvas; tirstGrid.Children.Add(thisScroll); if (Text == "" && _thisMod.TextToAppear != "") { throw new BasicBlankException("The bindings did not even work for text"); } var thisRect = ThisFrame.GetControlArea(); thisScroll.Margin = new Thickness(thisRect.Left + 3, thisRect.Top + 3, 3, 5); // try this way. PopulateCards(); MouseUp += BoneYardWPF_MouseUp; Content = tirstGrid; }
public void UpdateList(ScatteringPiecesObservable <CA, LI> mod) { _thisMod = mod; DataContext = null; DataContext = _thisMod; _objectList !.CollectionChanged -= ObjectList_CollectionChanged; _objectList = mod.RemainingList; _objectList.CollectionChanged += ObjectList_CollectionChanged; if (_objectList.Count == 0) { throw new BasicBlankException("The object list cannot be 0 when updating. Rethink"); } PopulateCards(); }
public void LoadList(ScatteringPiecesObservable <CA, LI> mod, string tagUsed) { EventAggregator thisE = Resolve <EventAggregator>(); thisE.Subscribe(this); SetBinding(TextProperty, new Binding(nameof(ScatteringPiecesObservable <CA, LI> .TextToAppear))); SetBinding(IsEnabledProperty, new Binding(nameof(ScatteringPiecesObservable <CA, LI> .IsEnabled))); _thisMod = mod; BindingContext = _thisMod; // so it can do the text and isenabled. _tagUsed = tagUsed; _objectList = mod.RemainingList; _objectList.CollectionChanged += ObjectList_CollectionChanged; _thisCanvas = new AbsoluteLayout(); _thisCanvas.GestureRecognizers.Add(new TapGestureRecognizer()); TapGestureRecognizer tap = (TapGestureRecognizer)_thisCanvas.GestureRecognizers.Single(); tap.NumberOfTapsRequired = 1; tap.Command = _thisMod.BoardCommand; _thisCanvas.HeightRequest = _thisMod.MaxSize.Height; _thisCanvas.WidthRequest = _thisMod.MaxSize.Width; Grid firstGrid = new Grid(); firstGrid.Children.Add(ThisDraw); ScrollView thisScroll = new ScrollView(); thisScroll.Orientation = ScrollOrientation.Both; thisScroll.Content = _thisCanvas; firstGrid.Children.Add(thisScroll); var thisRect = ThisFrame.GetControlArea(); thisScroll.Margin = new Thickness(thisRect.Left + 3, thisRect.Top + 3, 3, 5); // try this way. PopulateCards(); Content = firstGrid; }