예제 #1
0
 /// <summary>
 /// Opens an edit window on tab matching the view window at id matching the selected id on double click
 /// </summary>
 /// <param name="listView">the view window list view</param>
 public static EditTabs openEditOn(ListView listView)
 {
     if (listView.SelectedItem != null)
     {
         EditTabs editWindow = new EditTabs();
         editWindow.Show();
         string         typeName    = listView.ItemsSource.GetType().GetGenericArguments()[0].Name;
         ItemCollection tabs        = editWindow.editTabs.Items;
         UserControl    selectedTab = null;
         foreach (var item in tabs)
         {
             TabItem tab = (TabItem)item;
             if (tab.Header.ToString() == typeName + "s" || ((tab.Header.ToString() == "Contracts") && (typeName == "ContractGroupContainer")))
             {
                 tab.IsSelected = true;
                 selectedTab    = (UserControl)tab.Content;
             }
         }
         ComboBox idComboBox  = (ComboBox)selectedTab.FindName("IdComboBox");
         object   currentItem = listView.SelectedItem;
         string   id;
         if (typeName != "ContractGroupContainer")
         {
             id = currentItem.GetType().GetProperty("Id").GetValue(currentItem).ToString();
         }
         else
         {
             id = (currentItem as ContractGroupContainer).Value.Id;
         }
         idComboBox.SelectedItem = id;
         return(editWindow);
     }
     return(null);
 }
예제 #2
0
        private void EditWindowButton_Click(object sender, RoutedEventArgs e)
        {
            EditTabs editTabsWindow = new EditTabs();

            editTabsWindow.Show();
        }