Index: /branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.Views/3.3/Container2DView.xaml
===================================================================
--- /branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.Views/3.3/Container2DView.xaml	(revision 13578)
+++ /branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.Views/3.3/Container2DView.xaml	(revision 13578)
@@ -0,0 +1,9 @@
+﻿<UserControl x:Class="HeuristicLab.Problems.BinPacking.Views.Container2DView"
+             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
+             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
+             mc:Ignorable="d" 
+             d:DesignHeight="300" d:DesignWidth="300"
+             >
+</UserControl>
Index: /branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.Views/3.3/Container2DView.xaml.cs
===================================================================
--- /branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.Views/3.3/Container2DView.xaml.cs	(revision 13578)
+++ /branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.Views/3.3/Container2DView.xaml.cs	(revision 13578)
@@ -0,0 +1,83 @@
+﻿using System;
+using System.Linq;
+using System.Windows;
+using System.Windows.Forms;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Media3D;
+using HeuristicLab.Encodings.PackingEncoding.PackingPlan;
+using HeuristicLab.Problems.BinPacking.Dimensions;
+using HeuristicLab.Problems.BinPacking.PackingBin;
+using HeuristicLab.Problems.BinPacking.PackingItem;
+using Point = System.Windows.Point;
+using Size = System.Windows.Size;
+using UserControl = System.Windows.Controls.UserControl;
+
+namespace HeuristicLab.Problems.BinPacking.Views {
+  public partial class Container2DView : UserControl {
+    private int selectedItemKey;
+    private Size renderSize;
+    private BinPacking<TwoDimensionalPacking, RectangularPackingBin, RectangularPackingItem> packing;
+    public BinPacking<TwoDimensionalPacking, RectangularPackingBin, RectangularPackingItem> Packing {
+      get { return packing; }
+      set {
+        if (packing != value) {
+          this.packing = value;
+          ClearSelection(); // also updates visualization
+        }
+      }
+    }
+
+    public Container2DView() {
+      InitializeComponent();
+    }
+
+
+    protected override void OnRenderSizeChanged(SizeChangedInfo sizeInfo) {
+      base.OnRenderSizeChanged(sizeInfo);
+      var s = Math.Min(sizeInfo.NewSize.Height, sizeInfo.NewSize.Width);
+      renderSize = new Size(s, s);
+      InvalidateVisual();
+    }
+
+    // similar implementation to Container3DView (even though item selection is not supported for 2d packings TODO)
+    public void SelectItem(int itemKey) {
+      // selection of an item should make all other items semi-transparent
+      selectedItemKey = itemKey;
+      InvalidateVisual();
+    }
+    public void ClearSelection() {
+      // remove all transparency
+      selectedItemKey = -1;
+      InvalidateVisual();
+    }
+
+    protected override void OnRender(DrawingContext drawingContext) {
+      base.OnRender(drawingContext);
+      if (packing == null) return;
+      // the container should fill the whole size
+      var scalingX = renderSize.Width / Packing.BinMeasures.Width;
+      var scalingY = renderSize.Height / Packing.BinMeasures.Width;
+      // draw container
+      drawingContext.DrawRectangle(Brushes.LightGray, new Pen(Brushes.Black, 1), new Rect(new Point(0, 0), renderSize));
+
+      var selectedBrush = Brushes.MediumSeaGreen;
+      var unselectedBrush = selectedItemKey < 0 ? selectedBrush : Brushes.DarkGray;
+
+      foreach (var t in Packing.ItemMeasures) {
+        var key = t.Key;
+        var item = t.Value;
+        var pos = Packing.ItemPositions[key];
+
+        var scaledPos = new Point(pos.X * scalingX, pos.Y * scalingY);
+
+        var scaledSize = pos.Rotated ?
+          new Size(item.Height * scalingX, item.Width * scalingY) :
+          new Size(item.Width * scalingX, item.Height * scalingY);
+
+        var brush = key == selectedItemKey ? selectedBrush : unselectedBrush;
+        drawingContext.DrawRectangle(brush, new Pen(Brushes.Black, 1), new Rect(scaledPos, scaledSize));
+      }
+    }
+  }
+}
Index: /branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.Views/3.3/HeuristicLab.Problems.BinPacking.Views-3.3.csproj
===================================================================
--- /branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.Views/3.3/HeuristicLab.Problems.BinPacking.Views-3.3.csproj	(revision 13577)
+++ /branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.Views/3.3/HeuristicLab.Problems.BinPacking.Views-3.3.csproj	(revision 13578)
@@ -155,4 +155,13 @@
       <DependentUpon>Container3DView.xaml</DependentUpon>
     </Compile>
+    <Compile Include="Container2DView.xaml.cs">
+      <DependentUpon>Container2DView.xaml</DependentUpon>
+    </Compile>
+    <Compile Include="PackingPlan2DView.cs">
+      <SubType>UserControl</SubType>
+    </Compile>
+    <Compile Include="PackingPlan2DView.Designer.cs">
+      <DependentUpon>PackingPlan2DView.cs</DependentUpon>
+    </Compile>
     <Compile Include="PackingPlan3DView.cs">
       <SubType>UserControl</SubType>
@@ -175,4 +184,7 @@
   </ItemGroup>
   <ItemGroup>
+    <EmbeddedResource Include="PackingPlan2DView.resx">
+      <DependentUpon>PackingPlan2DView.cs</DependentUpon>
+    </EmbeddedResource>
     <EmbeddedResource Include="PackingPlan3DView.resx">
       <DependentUpon>PackingPlan3DView.cs</DependentUpon>
@@ -181,4 +193,8 @@
   <ItemGroup>
     <Page Include="Container3DView.xaml">
+      <Generator>MSBuild:Compile</Generator>
+      <SubType>Designer</SubType>
+    </Page>
+    <Page Include="Container2DView.xaml">
       <Generator>MSBuild:Compile</Generator>
       <SubType>Designer</SubType>
Index: /branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.Views/3.3/PackingPlan2DView.Designer.cs
===================================================================
--- /branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.Views/3.3/PackingPlan2DView.Designer.cs	(revision 13577)
+++ /branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.Views/3.3/PackingPlan2DView.Designer.cs	(revision 13578)
@@ -45,17 +45,8 @@
     /// </summary>
     private void InitializeComponent() {
-      this.packingPlan2D = new PackingPlanVisualizations.PackingPlan2D();
       this.binSelection = new System.Windows.Forms.ListBox();
+      this.elementHost = new System.Windows.Forms.Integration.ElementHost();
+      this.container2DView = new HeuristicLab.Problems.BinPacking.Views.Container2DView();
       this.SuspendLayout();
-      // 
-      // packingPlan2D
-      // 
-      this.packingPlan2D.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
-            | System.Windows.Forms.AnchorStyles.Left) 
-            | System.Windows.Forms.AnchorStyles.Right)));
-      this.packingPlan2D.Location = new System.Drawing.Point(67, 3);
-      this.packingPlan2D.Name = "packingPlan2D";
-      this.packingPlan2D.Size = new System.Drawing.Size(383, 340);
-      this.packingPlan2D.TabIndex = 3;
       // 
       // binSelection
@@ -70,10 +61,22 @@
       this.binSelection.SelectedIndexChanged += new System.EventHandler(this.binSelection_SelectedIndexChanged);
       // 
+      // elementHost
+      // 
+      this.elementHost.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
+            | System.Windows.Forms.AnchorStyles.Left) 
+            | System.Windows.Forms.AnchorStyles.Right)));
+      this.elementHost.Location = new System.Drawing.Point(67, 3);
+      this.elementHost.Name = "elementHost";
+      this.elementHost.Size = new System.Drawing.Size(383, 329);
+      this.elementHost.TabIndex = 5;
+      this.elementHost.Text = "elementHost";
+      this.elementHost.Child = this.container2DView;
+      // 
       // PackingPlan2DView
       // 
       this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
       this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+      this.Controls.Add(this.elementHost);
       this.Controls.Add(this.binSelection);
-      this.Controls.Add(this.packingPlan2D);
       this.Name = "PackingPlan2DView";
       this.Size = new System.Drawing.Size(453, 346);
@@ -83,7 +86,8 @@
 
     #endregion
-
-    private PackingPlanVisualizations.PackingPlan2D packingPlan2D;
+    
     private System.Windows.Forms.ListBox binSelection;
+    private System.Windows.Forms.Integration.ElementHost elementHost;
+    private Container2DView container2DView;
   }
 }
Index: /branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.Views/3.3/PackingPlan2DView.cs
===================================================================
--- /branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.Views/3.3/PackingPlan2DView.cs	(revision 13577)
+++ /branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.Views/3.3/PackingPlan2DView.cs	(revision 13578)
@@ -37,19 +37,8 @@
     }
 
-    protected override void DeregisterContentEvents() {
-      Content.QualityChanged -= new EventHandler(Content_QualityChanged);
-      base.DeregisterContentEvents();
-    }
-    protected override void RegisterContentEvents() {
-      base.RegisterContentEvents();
-      Content.QualityChanged += new EventHandler(Content_QualityChanged);
-    }
-
-
     public new PackingPlan<TwoDimensionalPacking, RectangularPackingBin, RectangularPackingItem> Content {
       get { return (PackingPlan<TwoDimensionalPacking, RectangularPackingBin, RectangularPackingItem>)base.Content; }
       set { base.Content = value; }
     }
-
 
     protected override void OnContentChanged() {
@@ -65,44 +54,16 @@
     }
 
-
     private void ClearState() {
-      packingPlan2D.InitializeContainer(0, 0);
+      container2DView.Packing = null;
     }
 
-    private void UpdateState(PackingPlan<TwoDimensionalPacking, RectangularPackingBin, RectangularPackingItem> plan) {     
+    private void UpdateState(PackingPlan<TwoDimensionalPacking, RectangularPackingBin, RectangularPackingItem> plan) {
       int currentBin = (binSelection != null && binSelection.SelectedItem != null) ? (int)(binSelection.SelectedItem) : 0;
-      var bin = plan.BinPackings[currentBin].BinMeasures;
-      packingPlan2D.InitializeContainer(bin.Width, bin.Height);
-      foreach (var entry in plan.BinPackings[currentBin].ItemMeasures) {
-        var position = plan.BinPackings[currentBin].ItemPositions[entry.Key];
-          packingPlan2D.AddItemToContainer(
-            position.Rotated ? entry.Value.Height : entry.Value.Width,
-            position.Rotated ? entry.Value.Width : entry.Value.Height, 
-            position.X, position.Y, entry.Key.ToString());
-      }
+      container2DView.Packing = plan.BinPackings[currentBin];
     }
 
     private void binSelection_SelectedIndexChanged(object sender, EventArgs e) {
       UpdateState(Content);
-      packingPlan2D.Refresh();
     }
-
-
-
-    private void Content_QualityChanged(object sender, EventArgs e) {
-      if (InvokeRequired)
-        Invoke(new EventHandler(Content_QualityChanged), sender, e);
-      else {
-        binSelection.Items.Clear();
-        if (Content == null) {
-          ClearState();
-        } else {
-          for (int i = 0; i < Content.NrOfBins; i++)
-            binSelection.Items.Add(i);
-          UpdateState(Content);
-        }
-        packingPlan2D.Refresh();
-      }
-    }  
   }
 }
Index: /branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Encodings/PackingPlans/BinPacking.cs
===================================================================
--- /branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Encodings/PackingPlans/BinPacking.cs	(revision 13577)
+++ /branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Encodings/PackingPlans/BinPacking.cs	(revision 13578)
@@ -41,5 +41,5 @@
 
     [Storable]
-    public ObservableDictionary<int, I> ItemMeasures { get; private set; }
+    public ObservableDictionary<int, I> ItemMeasures { get; private set; } // TODO: renamed to item
 
     [Storable]
@@ -47,5 +47,4 @@
 
     [Storable]
-    //public HashSet<D> ExtremePoints { get; protected set; }
     public SortedSet<D> ExtremePoints { get; protected set; }
 
@@ -55,10 +54,10 @@
     #endregion Properties
 
-    public BinPacking(B binMeasures) : base() {   
+    protected BinPacking(B binMeasures) : base() {   
       ItemPositions = new ObservableDictionary<int, D>();
       ItemMeasures = new ObservableDictionary<int, I>();
       BinMeasures = (B)binMeasures.Clone();
       OccupationLayers = new Dictionary<int, List<int>>();
-      InitializeOccupationLayers();
+      InitializeOccupationLayers(); // TODO
     }
 
