public editItemWindow(editTypes edType, AbstractItem item = null) { InitializeComponent(); List<Type> tlist = typeof(Book).Assembly.GetTypes().ToList<Type>(); List<string> Types = new List<string>() { "Book", "Journal" }; Subtypes = new ObservableCollection<string>(); typeCombo.ItemsSource = Types; typeCombo.DataContext = this; subTypeCombo.DataContext = this; if (edType == editTypes.Add) { saveButton.Visibility = System.Windows.Visibility.Hidden; addButton.Visibility = System.Windows.Visibility.Visible; } else if (edType == editTypes.Edit) { addButton.Visibility = System.Windows.Visibility.Hidden; saveButton.Visibility = System.Windows.Visibility.Visible; SearchObject sobj = getSearchObject(item); this.DataContext = sobj; } }
public editItemWindow(editTypes edType, AbstractItem item = null) { InitializeComponent(); List<Type> tlist = typeof(Book).Assembly.GetTypes().ToList<Type>(); List<string> Types = new List<string>() { "Book", "Journal" }; CategoriesList = new ObservableCollection<string>(); typeCombo.ItemsSource = Types; typeCombo.DataContext = this; subTypeCombo.DataContext = this; categoryCombo.DataContext = this; bestsellerInp.DataContext = this; itemSubjectInp.DataContext = this; etype = edType; if (edType == editTypes.Add) { saveButton.Visibility = System.Windows.Visibility.Hidden; addButton.Visibility = System.Windows.Visibility.Visible; serialNumInp.IsEnabled = false; } else if (edType == editTypes.Edit) { editedItem = item; editItem(item); } }