예제 #1
0
        public CreateBook()
        {
            InitializeComponent();
            pubYearCmb.ItemsSource   = Enumerable.Range(1950, DateTime.UtcNow.Year - 1948).ToList();
            pubYearCmb.SelectedIndex = 12;
            // Load categories to the combo box
            CategoryDataAccess categoryDataAccess = new CategoryDataAccess();
            List <Category>    categories         = categoryDataAccess.AllCategories();

            categoriesCmb.ItemsSource       = categories;
            categoriesCmb.SelectedValuePath = "CategoryId";
            categoriesCmb.DisplayMemberPath = "CategoryName";
            categoriesCmb.SelectedValue     = 2;
        }