public ViewPortContentControl() { _graphicsDeviceService = (MonoGameGraphicsDeviceService)GameServices.GetService <IGraphicsDeviceService>(); if (DesignerProperties.GetIsInDesignMode(this)) { return; } _instanceCount++; Loaded += OnLoaded; Unloaded += OnUnloaded; DataContextChanged += (sender, args) => { _viewModel = args.NewValue as IMonoGameViewModel; if (_viewModel != null) { _viewModel.GraphicsDeviceService = _graphicsDeviceService; } }; SizeChanged += (sender, args) => _viewModel?.SizeChanged(sender, args.Cast()); }
public MonoGameContentControl() { if (DesignerProperties.GetIsInDesignMode(this)) { return; } _instanceCount++; Loaded += OnLoaded; Unloaded += OnUnloaded; DataContextChanged += (sender, args) => { ViewModel = args.NewValue as IMonoGameViewModel; if (ViewModel != null) { ViewModel.GraphicsDeviceService = _graphicsDeviceService; } }; SizeChanged += (sender, args) => ViewModel?.SizeChanged(sender, args); }