コード例 #1
0
        public CategorySelectionViewData GetCategorySelectionViewData(string nameFilter)
        {
            CategorySelectionViewData vd = new CategorySelectionViewData();
            vd.Categories = new ObservableCollection<CategoryListItemViewData>();

            foreach (var category in catRep.GetListOfCategories(nameFilter))
            {
                vd.Categories.Add(new CategoryListItemViewData()
                {
                    CategoryID = category.CategoryID,
                    CategoryName = category.CategoryName,
                });
            }
            return vd;
        }
コード例 #2
0
        public DesignTimeCategorySelectionViewModel()
        {
            ViewData = new CategorySelectionViewData();
            var categories = new ObservableCollection<CategoryListItemViewData>()
            {
                new CategoryListItemViewData()
                {
                    CategoryID = 1,
                    CategoryName = "Jack"
                },
                new CategoryListItemViewData()
                {
                    CategoryID = 2,
                    CategoryName = "Johnny"
                },
                new CategoryListItemViewData()
                {
                    CategoryID = 3,
                    CategoryName = "Joe"
                }
            };
            ((CategorySelectionViewData)ViewData).Categories = categories;

        }