Exemplo n.º 1
0
        private void treeView1_AfterSelect(object sender, TreeViewEventArgs e)
        {
            btnAddDestinatario.Enabled  = treeView1.SelectedNode != null;
            btnRimuoviDuplicati.Enabled = treeView1.SelectedNode != null;

            if (treeView1.SelectedNode == null)
            {
                _elencoDestintari        = new BindingList <Destinatario>(new List <Destinatario>());
                dataGridView1.DataSource = _elencoDestintari;
            }
            else
            {
                var list = AppRepo.GetDestinatari((string)treeView1.SelectedNode.Tag).OrderBy(x => x.Address?.ToLower()).ToList();

                _elencoDestintari        = new BindingList <Destinatario>(list);
                dataGridView1.DataSource = _elencoDestintari;
            }
        }