private void InitializeGraphicsDevice() { if (_graphicsDeviceService == null) { _graphicsDeviceService = new DXGraphicsDeviceService(); // create the image source _imageSource = new DXImageSource( GraphicsDevice, (int)ActualWidth, (int)ActualHeight); rootImage.Source = _imageSource.WriteableBitmap; Services.AddService(typeof(IGraphicsDeviceService), _graphicsDeviceService); } }