Shapes are fairly heavy-weight. You should probably look into using graphics paths. Those are much more efficient when the user doesn't need to interact with individual parts of the drawing - and sometimes even then.
Try not to creating shapes that you do not need, and recycle ones that you already have. Basically no user will see the whole screen, so do NOT have the shapes that are out of sight. Don't create new ones f you can avoid - basically keep shapes falling out in a "ready" list, so you can reuse them.
If you have a large number of Shape instances, you could perhaps construct them asynchronously (on a worker thread) and queue up the actual Add operations via the Dispatcher. The idea here is that the UI won't be complete right away, but the user can start interacting right away, while elements continue loading. EDIT: The above is incorrect.
WPF does require that Visual elements be created on the UI thread. You can still accomplish this sort of 'lazy' visual loading using a pattern like this: private Random _random = new Random(); private void Window_Loaded(object sender, RoutedEventArgs e) { Thread testThread = new Thread(TestThread); testThread.Start(); } private void TestThread() { for (int I = 0; I Width = _random. Next(10, 50); shape.
Height = _random. Next(10, 50); shape. Fill = new SolidColorBrush(Colors.
Red); Canvas. SetLeft(shape, _random. Next(0, 400)); Canvas.
SetTop(shape, _random. Next(0, 200)); LayoutRoot.Children. Add(shape); } This basically queues up tasks to be run 'asynchronously' on the UI thread (i.e.
Whenever the message pump is being serviced), so you can maintain responsiveness while performing the 'long' UI update.
1: BASIC windows UI knowledge: UI elements MUST be created in the UI Thread - no worker thread here, dude ;) – TomTom Apr 26 '10 at 23:30 I stand corrected; I tested this out and creating a Visual does rely on the thread context. I was thinking it might not wire it up to the UI infrastructure until you actually add it to a Visual Tree. – Dan Bryant Apr 27 '10 at 1:53 That is an old issue going back to active x times and basically maintained for compatibility - you never know whether a sub-element starts putting up a windows form element which may be an active x control ;) – TomTom Apr 27 '10 at 7:07 The basic concept is still sound, however, even if the implementation details are different.
There's no need to lock up the UI thread for a long period when you can allow the UI to populate over time. There's a huge difference between 3 seconds of UI lock while a UI is filled and, say, 5 seconds of time for a large number of elements to 'asynchronously' fully populate. The former can be quite aggravating.
– Dan Bryant Apr 27 '10 at 13:53.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.