public ControlBarUC() { InitializeComponent(); var vm = new ControlBarViewModel(); this.DataContext = vm; }
public MainWindow(int id) { InitializeComponent(); NetVideoEntities db = new NetVideoEntities(); CustomerInfo cus = db.CustomerInfoes.FirstOrDefault(c => c.AccountId == id); controlBarVM = new ControlBarViewModel(); controlBarVM.CusName = cus.FirstName + " " + cus.LastName; controlBarVM.IdAccount = id; controlBarMain.DataContext = controlBarVM; List <VideoInfo> l = db.VideoInfoes.ToList(); ListVideoViewModel lvMyList = new ListVideoViewModel(); lvMyList.TitleList = "My list"; lvMyList.List = new ObservableCollection <VideoInfo>(l); listMyList.DataContext = lvMyList; ListVideoViewModel lvTrending = new ListVideoViewModel(); lvTrending.TitleList = "Trending now"; lvTrending.List = new ObservableCollection <VideoInfo>(l.Where(p => p.HotLevel == 2).ToList()); listTrending.DataContext = lvTrending; var minValue = db.VideoInfoes.Min(x => x.HotLevel); VideoInfo v = db.VideoInfoes.Where(x => x.HotLevel == minValue).FirstOrDefault(); DetailVideoViewModel d = new DetailVideoViewModel(); d.BindingDetail(v.Id, videoHot); }
/// <summary> /// Initialize Visual Browser /// Load all necessary data /// </summary> protected override async Task Initialize() { try { _currentMobileConfiguration = await _mobileConfigurationDataService.GetCurrentMobileConfiguration(); Buttons = VisualBrowserViewModelBuilder.CreateButtonsViewModel(_currentMobileConfiguration, ShowCategory).ToList(); TopCategories = VisualBrowserViewModelBuilder.CreateCategoriesViewModel(_currentMobileConfiguration.TopCategories, _navigateToMediaCommand, IsInternalModeEnable, SubCategorySelectionAction); ControlBarViewModel = new ControlBarViewModel(_dialogService, SettingsDataService, _mobileAppConfigDataService, _currentMobileConfiguration, _userSessionService, _contactsService, _presentationDataService, _syncLogService); ExpandedCategories = new ObservableCollection <CategoryViewModel>(); SearchViewModel = new SearchControlViewModel(_documentInfoDataService, _searchContentDataService, _navigationService, _navigateToMediaCommand); if (_orientation.HasValue) { RefreshButtons(_orientation.Value); GetAllCategoryContent().ForEach(c => c.HandleOrientation(_orientation.Value)); } await LoadBackgroundImage(); if (_orientation.HasValue) { BackgroundImage = ResolveBackgroundImage(_orientation.Value); } } catch (Exception e) { PlatformAdapter.SendToCustomLogger(e, LoggingLevel.Error); // Report error here } }
public ControlBarUC() { InitializeComponent(); this.DataContext = Viewmodel = new ControlBarViewModel(); }
public MainUserControl() { InitializeComponent(); this.DataContext = Vm = new ControlBarViewModel(); }
public ControlBarUC() { InitializeComponent(); this.DataContext = ViewModel = new ControlBarViewModel();// gán từ chính giữa ra bên phải rồi tới bên trái }
public ControlBarUC() { InitializeComponent(); this.DataContext = ViewModel = new ControlBarViewModel(); /// Mỗi thằng 1 view model riêng }
public ControlBarUC() { InitializeComponent(); // Cần tạo da các datacontex Viewmodel khác nhau, vì tránh trường hợp mỗi form sử dụng chung một model. this.DataContext = ViewModel = new ControlBarViewModel(); }
public ControlBarUC() { InitializeComponent(); this.DataContext = Viewmodel = new ControlBarViewModel(); //để mỗi thằng xài controlbar dùng viewmodel riêng }
public ControlBar() { InitializeComponent(); viewModel = new ControlBarViewModel(); this.DataContext = viewModel; }
public UserControl_ControlBar() { InitializeComponent(); ViewModel = new ControlBarViewModel(); this.DataContext = ViewModel; }