Hello.
Created a control derived from Canvas . I draw in it like this:
protected override void OnRender(DrawingContext dc) { base.OnRender(dc); if (Map != null) { if (Map.Count > 0) { FontFamily family = new FontFamily(new Uri("pack://application:,,,/Resources/Fonts/CSTITCHHD.ttf"), "CrossStitch_TG"); Brush brush = Brushes.Black; foreach (var m in Map) { FormattedText text = new FormattedText(m.Key.ToString(), new System.Globalization.CultureInfo("en-US"), FlowDirection.LeftToRight, new Typeface(family, FontStyles.Normal, FontWeights.Normal, FontStretches.Normal), 18, brush); var X = m.Value.X + (BlockSize / 2 - text.Width / 2) + Offset; var Y = m.Value.Y + (BlockSize / 2 - text.Height / 2) + Offset; Point p = new Point(X, Y); dc.DrawText(text, p); } } } } Map is a large collection (10000-50000 elements), it is filled in the ViewModel in the asynchronous method. At> 20,000, the UI hangs hard and long.
How to be? Is there a relatively simple option to draw asynchronously? Already tried a lot of things, nothing happens.
The speed is no longer important, the main thing is that the UI does not hang, even though the loading animation in the Canvas will hang, so that the rest of it does not hang.

