public void UpdateAction(ChatAction action) { var type = GetAnimationType(action); if (type == _action) { return; } if (_previous != null) { _previous.Dispose(); _previous = null; } if (_props != null) { _props.Dispose(); _props = null; } var color = Fill?.Color ?? Colors.Black; var visual = GetVisual(type, Window.Current.Compositor, color, out _props); _action = type; _previous = visual; ElementCompositionPreview.SetElementChildVisual(this, visual?.RootVisual); InvalidateArrange(); }