static void PropertyChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs e) { D3D11Image d3D11Image = d as D3D11Image; if (d3D11Image == null) { return; } d3D11Image.OnRender = null; ICommandListFactory commandListFactory = e.NewValue as ICommandListFactory; if (commandListFactory == null) { return; } RenderData _renderData = RenderData.Find(d3D11Image, true); if (_renderData == null) { return; } GraphicsDevice _graphicsDevice = _renderData.graphicsDevice; if (_graphicsDevice == null) { return; } SharpDX.Direct3D11.Device _device = _renderData.device; if (_device == null) { return; } d3D11Image.OnRender = (IntPtr surface, bool isNewSurface) => { #region --- OnRender Framebuffer _framebuffer = _renderData.FrameBuffer(surface, isNewSurface); if (_framebuffer == null) { return; } Veldrid.CommandList commandList = null; try { commandList = commandListFactory.BuildCommandList(_graphicsDevice, _framebuffer); if (commandList == null) { return; } _graphicsDevice.SubmitCommands(commandList); } finally { commandList?.Dispose(); } _device.ImmediateContext.Flush(); #endregion }; }