Esempio n. 1
0
        internal void HandlePointerPressed(int row)
        {
            _pressedCells.Clear();
            if (row > -1)
            {
                currentPressedRow = row;
                foreach (var item in _cells)
                {
                    if (item.Key.Row == row)
                    {
                        var cell = (item.Value as Border);

                        FrameworkElement element = null;
                        if (cell.Child != null)
                        {
                            element = cell.Child as FrameworkElement;
                        }
                        else
                        {
                            element = cell;
                        }

                        if (item.Key.Column == 0)
                        {
                            element.RenderTransform = new ScaleTransform()
                            {
                                ScaleX = 0.9, ScaleY = 0.9, CenterX = element.ActualWidth, CenterY = element.ActualHeight / 2
                            };
                        }
                        else if (item.Key.Column == this.Columns.Count - 1)
                        {
                            element.RenderTransform = new ScaleTransform()
                            {
                                ScaleX = 0.9, ScaleY = 0.9, CenterX = 0, CenterY = element.ActualHeight / 2
                            };
                        }
                        else
                        {
                            element.RenderTransform = new ScaleTransform()
                            {
                                ScaleX = 1, ScaleY = 0.9, CenterX = 0, CenterY = element.ActualHeight / 2
                            };
                        }
                        cell.Background = Grid.PressedBackground;
                        _pressedCells.Add(item.Key, item.Value);
                    }
                }
            }
        }
Esempio n. 2
0
        internal void HandlePointerOver(int row)
        {
            if (Grid.Rows.Count <= row)
            {
                _pointerOverCells.Clear();
                return;
            }
            //clear all
            {
                currentpointerOverRow = -1;
                foreach (var item in _pointerOverCells)
                {
                    var element = item.Value as Border;
                    var even    = true;
                    if (Grid.Rows.Count > item.Key.Row)
                    {
                        even = Grid.Rows[item.Key.Row].VisibleIndex % 2 == 0;
                    }
                    element.Background = even || Grid.AlternatingRowBackground == null
                           ? Grid.RowBackground
                           : Grid.AlternatingRowBackground;
                }
                _pointerOverCells.Clear();
            }

            if (row > -1)
            {
                currentpointerOverRow = row;
                foreach (var item in _cells)
                {
                    var element = item.Value as Border;
                    if (item.Key.Row == row)
                    {
                        element.Background = Grid.PointerOverBackground;
                        _pointerOverCells.Add(item.Key, item.Value);
                    }
                }
            }
        }