public void CollectItemMaps()
        {
            ItemMap itemMap = new ItemMap(MappingType.Sheet);

            itemMap.ParameterNames.Add("Sheet Name");
            itemMap.ParameterNames.Add("Sheet Number");
            itemMaps.Add(itemMap);

            ItemMap itemMap2 = new ItemMap(MappingType.View);

            itemMap2.ParameterNames.Add("View Name");
            itemMaps.Add(itemMap2);
        }
 private void comboBoxType_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     try
     {
         if (null != comboBoxType.SelectedItem)
         {
             ItemMap selectedItem = comboBoxType.SelectedItem as ItemMap;
             comboBoxParameter.ItemsSource   = selectedItem.ParameterNames;
             comboBoxParameter.SelectedIndex = 0;
         }
     }
     catch (Exception ex)
     {
         string message = ex.Message;
     }
 }
        private void buttonAddItem_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (null != comboBoxType.SelectedItem && null != comboBoxParameter.SelectedItem)
                {
                    ItemMap itemMap   = comboBoxType.SelectedItem as ItemMap;
                    string  parameter = comboBoxParameter.SelectedItem.ToString();

                    if (null != itemMap && !string.IsNullOrEmpty(parameter))
                    {
                        string sampleSourceName = "";
                        double suffix           = 0;
                        if (dataGridItem.Items.Count > 0)
                        {
                            RevitItemMapper lastItem = dataGridItem.Items[dataGridItem.Items.Count - 1] as RevitItemMapper;
                            sampleSourceName = lastItem.SourceValue.ToString();

                            if (DataGridUtils.GetSuffix(sampleSourceName, out suffix))
                            {
                                sampleSourceName = sampleSourceName.Replace(suffix.ToString(), (suffix + 1).ToString());
                            }
                            else
                            {
                                sampleSourceName += " " + (suffix + 1).ToString();
                            }
                        }

                        if (string.IsNullOrEmpty(sampleSourceName))
                        {
                            sampleSourceName = "New Item 1";
                        }

                        RevitItemMapper itemMapper = new RevitItemMapper(Guid.NewGuid(), itemMap.ItemMapType, parameter, sampleSourceName, "");
                        this.RvtSheetData.ItemMaps.Add(itemMapper);
                        bool dbUpdated = SheetDataWriter.ChangeReplaceItem(itemMapper, CommandType.INSERT);
                    }
                }
            }
            catch (Exception ex)
            {
                string message = ex.Message;
            }
        }