diff --git a/GisDevelop_Exp/MainWindow.xaml b/GisDevelop_Exp/MainWindow.xaml
index 191babe..be4eeb8 100644
--- a/GisDevelop_Exp/MainWindow.xaml
+++ b/GisDevelop_Exp/MainWindow.xaml
@@ -50,17 +50,17 @@
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/GisDevelop_Exp/MainWindow.xaml.cs b/GisDevelop_Exp/MainWindow.xaml.cs
index 7570643..df055c2 100644
--- a/GisDevelop_Exp/MainWindow.xaml.cs
+++ b/GisDevelop_Exp/MainWindow.xaml.cs
@@ -526,7 +526,7 @@ namespace GisDevelop_Exp
if (listBoxItem == null) return;
DataObject dataObj = new DataObject(listBoxItem.Content as CheckBox);
- DragDrop.DoDragDrop(LayerListBox, dataObj, DragDropEffects.Move);
+ DragDrop.DoDragDrop(LayerListBox, listBoxItem, DragDropEffects.Move);
}
}
@@ -539,8 +539,9 @@ namespace GisDevelop_Exp
return;
}
- var sourcePerson = e.Data.GetData(typeof(CheckBox)) as CheckBox;
- if (sourcePerson == null)
+ var sourceItem = e.Data.GetData(typeof(ListBoxItem)) as ListBoxItem;
+ // var sourcePerson = sourceItem.Content;
+ if (sourceItem == null)
{
return;
}
@@ -550,18 +551,18 @@ namespace GisDevelop_Exp
{
return;
}
-
+
var targetPerson = listBoxItem.Content as CheckBox;
- if (ReferenceEquals(targetPerson, sourcePerson))
+ if (ReferenceEquals(listBoxItem, sourceItem))
{
return;
}
- int targetIndex = LayerListBox.Items.IndexOf(targetPerson);
- int sourceIndex = LayerListBox.Items.IndexOf(sourcePerson);
- LayerListBox.Items.Remove(sourcePerson);
- LayerListBox.Items.Insert(targetIndex, sourcePerson);
- MoveLayer(sourcePerson.ToolTip as string,targetPerson.ToolTip as string);
+ int targetIndex = LayerListBox.Items.IndexOf(listBoxItem);
+ int sourceIndex = LayerListBox.Items.IndexOf(sourceItem);
+ LayerListBox.Items.Remove(sourceItem);
+ LayerListBox.Items.Insert(targetIndex, sourceItem);
+ MoveLayer(sourceItem.ToolTip as string,listBoxItem.ToolTip as string);
}
private void AddLayerNameToList()
@@ -585,14 +586,16 @@ namespace GisDevelop_Exp
};
Console.WriteLine(pLayers[i].Name);
cb.Content = pLayers[i].Name;
- cb.ToolTip = pLayers[i].Name;
+ cb.ToolTip = cb.Content;
cb.Name = pLayers[i].Name;
cb.IsChecked = true;
cb.Focusable = false;
cb.Checked += new RoutedEventHandler(Checked_Layers_CheckBox);
cb.Unchecked += new RoutedEventHandler(UnChecked_Layers_CheckBox);
ListBoxItem listBoxItem = new ListBoxItem();
- LayerListBox.Items.Add(cb);
+ listBoxItem.Content = cb;
+ listBoxItem.ToolTip = pLayers[i].Name;
+ LayerListBox.Items.Add(listBoxItem);
}
}