ZoomableCanvas

ZoomableCanvas is the Panel that displays almost all of the elements in Code Canvas.  Code Canvas is actually made up of several layers of ZoomableCanvases that are stacked on top of each other, and they are synchronized by simply sharing the same values for Scale and Offset.  Scale and Offset are the driving forces behind…

5

ZoomableCanvas: Preface

When I started writing Code Canvas back in 2008, I quickly realized that using a simple ScaleTransform on an existing Canvas would not produce the experience that I wanted.  This was mostly because the elements on my canvas have many fine details such as the dog-ears on files, the icons next to identifiers, and the…

5

PriorityQuadTree

Chris Lovett has a written a cool Virtualized WPF Canvas that lets you pan and zoom around a huge canvas full of shapes, and it only creates those shapes which can be seen on your screen at the time (i.e. within your viewbox of the canvas).  As you pan around, it destroys the shapes that…

0

VirtualPanel

Virtualization, according to the documentation for WPF’s built-in VirtualizingStackPanel, refers to a technique by which a subset of user interface (UI) elements are generated from a larger number of data items based on which items are visible on-screen.  This is a great feature since WPF cannot show more than about 2,000 visuals on the screen…

0

Rect.Intersects and IsDefined

When working on the PriorityQuadTree, most of the code I was reading and writing revolved around rectangle intersection.  Rect defines an IntersectsWith method, but it doesn’t work with rectangles that are infinitely wide or tall like new Rect(Double.NegativeInfinity, Double.NegativeInfinity, Double.PositiveInfinity, Double.PositiveInfinity)), and asking whether anything intersects with Rect.Empty returns false.  This is opposite from set…

0

Snapshooter

I’ve been working on a very large-scale canvas application for a while now, and I finally checked in the first working prototype today.   The biggest challenge for this application is that the elements on the canvas are very rich.  They aren’t just simple boxes and lines.  Some of the elements actually contain full blown FlowDocuments…

2

ArithmeticConverter

Using a declarative language like XAML to define a UI feels like the right thing to do, but it has its drawbacks.  I appreciate that disallowing procedural code eliminates race conditions and side effects, but what about purely functional operations like simple arithmetic?  The lack of simple math operations gets even more frustrating since we…

0

Presentation.More

In the same vein as System.More, I’ve also created a Windows Presentation Foundation counterpart called Presentation.More.  And just like System.More defines classes in the same System namespaces as System.dll and System.Core.dll, Presentation.More also defines classes in the System.Windows namespaces directly.  Not only does this work elegantly for code-based languages like C# and VB, but it…

0