void XnaWindowHost_Loaded(object sender, RoutedEventArgs e) { if (graphicsService == null) { graphicsService = GraphicsDeviceService.AddRef(hWnd, (int)ActualWidth, (int)ActualHeight); services.AddService <IGraphicsDeviceService>(graphicsService); LoadContent(); if (OnLoadContent != null) { OnLoadContent(this, new GraphicsDeviceEventArgs(graphicsService.GraphicsDevice)); } timer.Start(); } }