private void OnLayoutChanged(Layout newValue) { if (_algorithm != null) { _algorithm.Dispose(); _algorithm = null; } if (_isLoaded) { CreateLayoutAlgorithm(newValue); } }