Index: trunk/sources/HeuristicLab.Core.Views/3.3/ItemListView.cs
===================================================================
--- trunk/sources/HeuristicLab.Core.Views/3.3/ItemListView.cs	(revision 3341)
+++ trunk/sources/HeuristicLab.Core.Views/3.3/ItemListView.cs	(revision 3362)
@@ -92,18 +92,39 @@
       Caption = "Item List";
       while (itemsListView.Items.Count > 0) RemoveListViewItem(itemsListView.Items[0]);
-      itemsListView.Enabled = false;
-      detailsGroupBox.Enabled = false;
       viewHost.Content = null;
-      addButton.Enabled = false;
-      moveUpButton.Enabled = false;
-      moveDownButton.Enabled = false;
-      removeButton.Enabled = false;
-
       if (Content != null) {
         Caption += " (" + Content.GetType().Name + ")";
-        itemsListView.Enabled = true;
-        addButton.Enabled = !Content.IsReadOnly;
         foreach (T item in Content)
           AddListViewItem(CreateListViewItem(item));
+      }
+      SetEnabledStateOfControls();
+    }
+
+    protected override void OnReadOnlyChanged() {
+      base.OnReadOnlyChanged();
+      SetEnabledStateOfControls();
+    }
+
+    private void SetEnabledStateOfControls() {
+      if (Content == null) {
+        addButton.Enabled = false;
+        moveUpButton.Enabled = false;
+        moveDownButton.Enabled = false;
+        removeButton.Enabled = false;
+        itemsListView.Enabled = false;
+        detailsGroupBox.Enabled = false;
+      } else {
+        addButton.Enabled = !Content.IsReadOnly && !ReadOnly;
+        moveUpButton.Enabled = itemsListView.SelectedItems.Count == 1 &&
+                               itemsListView.SelectedIndices[0] != 0 &&
+                               !Content.IsReadOnly && !ReadOnly;
+        moveDownButton.Enabled = itemsListView.SelectedItems.Count == 1 &&
+                                 itemsListView.SelectedIndices[0] != itemsListView.Items.Count - 1 &&
+                                 !Content.IsReadOnly && !ReadOnly;
+        removeButton.Enabled = itemsListView.SelectedItems.Count > 0 &&
+                               !Content.IsReadOnly && !ReadOnly;
+        itemsListView.Enabled = true;
+        detailsGroupBox.Enabled = true;
+        viewHost.ReadOnly = ReadOnly;
       }
     }
@@ -131,4 +152,5 @@
       ((T)listViewItem.Tag).ItemImageChanged += new EventHandler(Item_ItemImageChanged);
       ((T)listViewItem.Tag).ToStringChanged += new EventHandler(Item_ToStringChanged);
+      AdjustListViewColumnSizes();
     }
     protected virtual void InsertListViewItem(int index, ListViewItem listViewItem) {
@@ -136,4 +158,5 @@
       ((T)listViewItem.Tag).ItemImageChanged += new EventHandler(Item_ItemImageChanged);
       ((T)listViewItem.Tag).ToStringChanged += new EventHandler(Item_ToStringChanged);
+      AdjustListViewColumnSizes();
     }
     protected virtual void RemoveListViewItem(ListViewItem listViewItem) {
@@ -156,13 +179,14 @@
     }
 
+    #region ListView Events
     protected virtual void itemsListView_SelectedIndexChanged(object sender, EventArgs e) {
       moveUpButton.Enabled = itemsListView.SelectedItems.Count == 1 &&
                              itemsListView.SelectedIndices[0] != 0 &&
-                             !Content.IsReadOnly;
+                             !Content.IsReadOnly && !ReadOnly;
       moveDownButton.Enabled = itemsListView.SelectedItems.Count == 1 &&
                                itemsListView.SelectedIndices[0] != itemsListView.Items.Count - 1 &&
-                               !Content.IsReadOnly;
+                               !Content.IsReadOnly && !ReadOnly;
       removeButton.Enabled = itemsListView.SelectedItems.Count > 0 &&
-                             !Content.IsReadOnly;
+                             !Content.IsReadOnly && !ReadOnly;
 
       if (itemsListView.SelectedItems.Count == 1) {
@@ -177,13 +201,7 @@
     }
 
-    #region ListView Events
-    protected virtual void itemsListView_SizeChanged(object sender, EventArgs e) {
-      if (itemsListView.Columns.Count > 0)
-        itemsListView.Columns[0].Width = Math.Max(0, itemsListView.Width - 25);
-    }
-
     protected virtual void itemsListView_KeyDown(object sender, KeyEventArgs e) {
       if (e.KeyCode == Keys.Delete) {
-        if ((itemsListView.SelectedItems.Count > 0) && !Content.IsReadOnly) {
+        if ((itemsListView.SelectedItems.Count > 0) && !Content.IsReadOnly && !ReadOnly) {
           foreach (ListViewItem item in itemsListView.SelectedItems)
             Content.RemoveAt(item.Index);
@@ -195,5 +213,5 @@
       if (itemsListView.SelectedItems.Count == 1) {
         T item = (T)itemsListView.SelectedItems[0].Tag;
-        IView view = MainFormManager.CreateDefaultView(item);
+        IView view = MainFormManager.CreateDefaultView(item, ReadOnly);
         if (view != null) view.Show();
       }
@@ -206,5 +224,5 @@
       data.SetData("Type", item.GetType());
       data.SetData("Value", item);
-      if (Content.IsReadOnly) {
+      if (Content.IsReadOnly || ReadOnly) {
         DoDragDrop(data, DragDropEffects.Copy | DragDropEffects.Link);
       } else {
@@ -217,5 +235,5 @@
       e.Effect = DragDropEffects.None;
       Type type = e.Data.GetData("Type") as Type;
-      if ((!Content.IsReadOnly) && (type != null) && (typeof(T).IsAssignableFrom(type))) {
+      if (!Content.IsReadOnly && !ReadOnly && (type != null) && (typeof(T).IsAssignableFrom(type))) {
         if ((e.KeyState & 8) == 8) e.Effect = DragDropEffects.Copy;  // CTRL key
         else if ((e.KeyState & 4) == 4) e.Effect = DragDropEffects.Move;  // SHIFT key
@@ -360,4 +378,14 @@
             UpdateListViewItemText(listViewItem);
         }
+        AdjustListViewColumnSizes();
+      }
+    }
+    #endregion
+
+    #region Helpers
+    protected virtual void AdjustListViewColumnSizes() {
+      if (itemsListView.Items.Count > 0) {
+        for (int i = 0; i < itemsListView.Columns.Count; i++)
+          itemsListView.Columns[i].AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent);
       }
     }
