private void OnToggleCellState(object arg) { Point pointer = Mouse.GetPosition((IInputElement)arg); double gridWidthInPixel = ((ItemsControl)arg).ActualWidth; double gridHeightInPixel = ((ItemsControl)arg).ActualHeight; GameOfLifeWorld.ToggleCellState(pointer, gridWidthInPixel, gridHeightInPixel); }