public ManifestView(ModList modlist) { Modlist = modlist; var manifest = new Manifest(modlist); if (ViewModel == null) { ViewModel = new ManifestVM(manifest); } InitializeComponent(); this.WhenActivated(disposable => { this.OneWayBind(ViewModel, x => x.Name, x => x.Name.Text) .DisposeWith(disposable); this.OneWayBind(ViewModel, x => x.Author, x => x.Author.Text) .DisposeWith(disposable); this.OneWayBind(ViewModel, x => x.Description, x => x.Description.Text) .DisposeWith(disposable); this.OneWayBind(ViewModel, x => x.SearchResults, x => x.ModsList.ItemsSource) .DisposeWith(disposable); this.OneWayBind(ViewModel, x => x.InstallSize, x => x.InstallSize.Text) .DisposeWith(disposable); this.OneWayBind(ViewModel, x => x.DownloadSize, x => x.DownloadSize.Text) .DisposeWith(disposable); this.Bind(ViewModel, x => x.SearchTerm, x => x.SearchBar.Text) .DisposeWith(disposable); this.BindCommand(ViewModel, x => x.SortByNameCommand, x => x.OrderByNameButton) .DisposeWith(disposable); this.BindCommand(ViewModel, x => x.SortBySizeCommand, x => x.OrderBySizeButton) .DisposeWith(disposable); }); }
public ManifestView(ModList modlist) { Modlist = modlist; var manifest = new Manifest(modlist); if (ViewModel == null) { ViewModel = new ManifestVM(manifest); } InitializeComponent(); this.WhenActivated(disposable => { this.OneWayBind(ViewModel, x => x.Name, x => x.Name.Text) .DisposeWith(disposable); this.OneWayBind(ViewModel, x => x.Author, x => x.Author.Text) .DisposeWith(disposable); this.OneWayBind(ViewModel, x => x.Description, x => x.Description.Text) .DisposeWith(disposable); this.OneWayBind(ViewModel, x => x.Archives, x => x.ModsList.ItemsSource) .DisposeWith(disposable); this.OneWayBind(ViewModel, x => x.InstallSize, x => x.InstallSize.Text) .DisposeWith(disposable); this.OneWayBind(ViewModel, x => x.DownloadSize, x => x.DownloadSize.Text) .DisposeWith(disposable); }); }