/// <summary> /// Handles the touch move event. /// </summary> /// <param name="e">Touch event arguments.</param> /// <returns>Touch event arguments.</returns> //protected override void OnTouchMove(TouchEventArgs e) //{ // /* // var x = e.Touches[0].X; // var y = e.Touches[0].Y; // // The pressed state only triggers when touches occur within this UI element's boundaries. // // This check guarantees whether we need to process move events or not. // if (!_pressed) // return; // if (!_moving) // { // if (_ignoredTouchMoves < _maxIgnoredTouchMoves) // _ignoredTouchMoves++; // else // _moving = true; // } // else // { // int dragDistance = y - _lastPressY; // _listY = _lastListY - dragDistance; // _listY = GlideUtils.Math.MinMax(_listY, 0, _listMaxY); // //Graphics.DrawImage(X, Y, _bitmap.GetBitmap(), 0, _listY, Width, Height); // //Glide.Flush(this); // } // */ // //e.StopPropagation(); // //return e; // var evt = new RoutedEvent("TouchMoveEvent", RoutingStrategy.Bubble, typeof(RoutedEventHandler)); // var args = new RoutedEventArgs(evt, this); // //this.Click?.Invoke(this, args); // e.Handled = args.Handled; // //this.isPressed = false; // if (this.Parent != null) // this.Invalidate(); //} /// <summary> /// Disposes all disposable objects in this object. /// </summary> public void Dispose() { if (_bitmap != null) { _bitmap.Dispose(); _bitmap = null; } }
/// <summary> /// Disposes all disposable objects in this object. /// </summary> public void Dispose() { if (_headers != null) { _headers.Dispose(); } if (_items != null) { _items.Dispose(); } _DataGridIcon_Asc.Dispose(); _DataGridIcon_Desc.Dispose(); }
/// <summary> /// Renders the DataGrid onto it's parent container's graphics. /// </summary> public override void OnRender(DrawingContext dc) { if (ShowHeaders && _renderHeaders) { _renderHeaders = false; RenderHeaders(); } if (_renderItems) { _renderItems = false; // Only recreate the items Bitmap if necessary if (_items == null || _items.GetBitmap().Height != _rows.Count * RowHeight) { if (_items != null) { _items.Dispose(); } if (_rows.Count < _rowCount) { _items = new GlideGraphics(Width, _rowCount * RowHeight); RenderEmpty(); } else { _items = new GlideGraphics(Width, _rows.Count * RowHeight); } } else { _items.DrawRectangle(Glide.Ext.Colors.Black, 1, 0, 0, Width, _items.GetBitmap().Height, 0, 0, Glide.Ext.Colors.Transparent, 0, 0, Glide.Ext.Colors.Transparent, 0, 0, 255); } if (_rows.Count > 0) { for (int i = 0; i < _rows.Count; i++) { UpdateItem(i, false); } } } int x = /*this.Parent._finalX +*/ X; int y = /*this.Parent._finalY +*/ Y; if (_showHeaders) { //BitmapImage.FromGraphics(System.Drawing.Graphics.FromImage(x)) dc.DrawImage(BitmapImage.FromGraphics(System.Drawing.Graphics.FromImage(_headers.GetBitmap())), x, y, 0, 0, Width, RowHeight); y += RowHeight; } dc.DrawImage(BitmapImage.FromGraphics(System.Drawing.Graphics.FromImage(_items.GetBitmap())), x, y, 0, _listY, Width, _rowCount * RowHeight); if (ShowScrollbar) { _scrollbarHeight = RowHeight; int travel = Height - _scrollbarHeight; if (_rows.Count > 0) { _scrollbarTick = (int)System.Math.Round((double)(travel / _rows.Count)); } else { _scrollbarTick = 0; } _scrollbarHeight = Height - ((_rows.Count - _rowCount) * _scrollbarTick); x += Width - ScrollbarWidth; y = /*parent y*/ 0 + Y; //dc.DrawRectangle(Glide.Ext.Colors.Black, 0, x, y, ScrollbarWidth, Height, 0, 0, ScrollbarBackColor, 0, 0, Glide.Ext.Colors.Black, 0, 0, 255); var pen = new Media.Pen(Media.Colors.Black, 0); dc.DrawRectangle(new SolidColorBrush(Media.Colors.Black), pen, x, y, ScrollbarWidth, Height); // Only show the scrollbar scrubber if it's smaller than the Height if (_scrollbarHeight < Height) { //dc.DrawRectangle(Glide.Ext.Colors.Black, 0, x, y + (_scrollIndex * _scrollbarTick), ScrollbarWidth, _scrollbarHeight, 0, 0, ScrollbarScrubberColor, 0, 0, Glide.Ext.Colors.Black, 0, 0, 255); pen = new Media.Pen(Media.Colors.Black, 0); dc.DrawRectangle(new SolidColorBrush(Media.Colors.Black), pen, x, y + (_scrollIndex * _scrollbarTick), ScrollbarWidth, _scrollbarHeight); } } }