Пример #1
0
        private void ButtonUpdateItem_Click(object sender, RoutedEventArgs e)
        {
            if ((ListViewElements.SelectedItem != null) && (ListViewElements.SelectedItem is ToolBoxItem))
            {
                ToolBoxItem item = ListViewElements.SelectedItem as ToolBoxItem;
                if (item != null)
                {
                    //Находим группу которой принадлежит выделенный элемент
                    ExpanderData selectedGroup = null;
                    foreach (ExpanderData data in expanderList)
                    {
                        if (data.Items.Contains(item))
                        {
                            selectedGroup = data;
                            break;
                        }
                    }

                    ToolBoxItemProperty tprop = new ToolBoxItemProperty(item);
                    if (tprop.ShowDialog() == true)
                    {
                        ListViewElements.ItemsSource = null;
                        selectedGroup.Items.Remove(item);
                        selectedGroup.Items.Add(tprop.ToolBoxItem);
                        ListViewElements.ItemsSource = selectedGroup.Items;
                    }
                }
            }
        }
Пример #2
0
 private void ButtonNewItem_Click(object sender, RoutedEventArgs e)
 {
     if ((ListViewGroups.SelectedItem != null) && (ListViewGroups.SelectedItem is ExpanderData))
     {
         ExpanderData selectedGroup = ListViewGroups.SelectedItem as ExpanderData;
         if (selectedGroup != null)
         {
             ToolBoxItemProperty tprop = new ToolBoxItemProperty(selectedGroup);
             if (tprop.ShowDialog() == true)
             {
                 ListViewElements.ItemsSource = null;
                 selectedGroup.Items.Add(tprop.ToolBoxItem);
                 ListViewElements.ItemsSource = selectedGroup.Items;
             }
         }
     }
 }