title: More than 2 millions rectangles in a WPF canvas
body: <p>I am creating a custom control for semiconductor wafermap <img src="https://i.stack.imgur.com/BqH5B.png" alt="enter image description here"></p>
  
  <p>Each of those small rectangle need to satisfy following requirements;
  1) Tooltip to show the index
  2) clickable to include or exclude from the wafermap definition.</p>
  
  <p>no of dies in the wafermap may cross 2 millions in the case of 1400 x 1450 dies.</p>
  
  <p>at certain point i need to show all the dies in a window (most of the clicking will happen in zoomed view).</p>
  
  <p>Currently I am adding each die separately using Rectangle shape and store the coordinate information (index like (10,10)) for the tooltip as an attached property.</p>
  
  <p>I use different style to each die; depending on certain calculation and position of the die.</p>
  
  <pre><code>DieStyle1 = new Style { TargetType = typeof(Rectangle) };
  DieStyle1.Setters.Add(new Setter(Shape.FillProperty, Brushes.MediumSlateBlue));
  DieStyle1.Setters.Add(new Setter(Shape.StrokeProperty, Brushes.White));
  DieStyle1.Setters.Add(new EventSetter(MouseDownEvent, new MouseButtonEventHandler(DieStyle1_MouseDown)));
  </code></pre>
  
  <p>this approach is slow and use high memory too. so suggest a better way to achieve this in WPF? </p>