示例#1
0
 private void _mapInterActionHandler_ShapesSelected(MapInterActionHandler s, LayerEventArg e)
 {
     if (((Shapefile)MapWindowManager.MapLayersHandler[e.LayerHandle].LayerObject).FieldIndexByName["MWShapeID"] >= 0)
     {
         _gridWaslClicked = false;
         if (e.SelectedIndexes.Count() == 1)
         {
             _gridWaslClicked = true;
             if (dataGridAttributes.Items.Count == 1)
             {
                 dataGridAttributes.DataContext = ShapefileAttributeTableManager.SetupAttributeTable(ShapeFile, true);
                 for (int x = 0; x < e.SelectedIndexes.Count(); x++)
                 {
                     foreach (DataRowView item in dataGridAttributes.Items)
                     {
                         if (item.Row.Field <int>("MWShapeID") == e.SelectedIndexes[0])
                         {
                             //dataGridAttributes.SelectedItem = item;
                             dataGridAttributes.SelectedItems.Add(item);
                             //break;
                         }
                     }
                 }
                 var t = dataGridAttributes.LayoutTransform;
             }
             else
             {
                 foreach (DataRowView item in dataGridAttributes.Items)
                 {
                     if (item.Row.Field <int>("MWShapeID") == e.SelectedIndexes[0])
                     {
                         dataGridAttributes.SelectedItem = item;
                         dataGridAttributes.ScrollIntoView(dataGridAttributes.SelectedItem);
                     }
                 }
             }
         }
         else
         {
             //dataGridAttributes.DataContext = ShapefileAttributeTableManager.SetupAttributeTable(ShapeFile,true);
             ShowShapeFileAttribute();
             for (int x = 0; x < e.SelectedIndexes.Count(); x++)
             {
                 foreach (DataRowView item in dataGridAttributes.Items)
                 {
                     if (item.Row.Field <int>("MWShapeID") == e.SelectedIndexes[0])
                     {
                         //dataGridAttributes.SelectedItem = item;
                         dataGridAttributes.SelectedItems.Add(item);
                         //break;
                     }
                 }
             }
         }
     }
 }
示例#2
0
 public void ShowShapeFileAttribute()
 {
     dataGridAttributes.DataContext = ShapefileAttributeTableManager.SetupAttributeTable(ShapeFile);
     labelTitle.Content             = ShapefileAttributeTableManager.DataCaption;
 }