Ejemplo n.º 1
0
        private void AddNewAreaform_Load(object sender, EventArgs e)
        {
            _viewModel.Load();

            cboFactory.DataSource    = _viewModel.factories;
            cboFactory.DisplayMember = "FactoryName";
            cboFactory.ValueMember   = "Id";
        }
Ejemplo n.º 2
0
        private void LoadData()
        {
            _viewModel.Load();

            areasBindingSource.DataSource = _viewModel.areas; //set the view model data source

            //set the areas list box
            lbAreaListNav.DataSource    = areasBindingSource;
            lbAreaListNav.DisplayMember = "AreaName";
            lbAreaListNav.ValueMember   = "Id";

            areasBindingSource.ResetBindings(false);

            //set the controls to the binding source
            txtAreaName.DataBindings.Add("Text", areasBindingSource, "AreaName", false, DataSourceUpdateMode.OnPropertyChanged);
            txtAreaComments.DataBindings.Add("Text", areasBindingSource, "CommentsNotes", false, DataSourceUpdateMode.OnPropertyChanged);

            cboFactory.DataSource    = _viewModel.factories;
            cboFactory.DisplayMember = "FactoryName";
            cboFactory.ValueMember   = "Id";
            cboFactory.DataBindings.Add("SelectedValue", areasBindingSource, "FactoryId");
        }