Example #1
0
        private void EdytujButton_Click(object sender, RoutedEventArgs e)
        {
            var     item         = (ListBoxItem)ListBox.Items.GetItemAt(ListBox.SelectedIndex);
            Osoba   edit         = lista[ListBox.SelectedIndex];
            UserDlg dodajUserDlg = new UserDlg();

            dodajUserDlg.osoba = edit;
            if (dodajUserDlg.ShowDialog() == true)
            {
                edit         = dodajUserDlg.osoba;
                item.Content = edit.imie + Environment.NewLine + edit.nazwisko + Environment.NewLine + edit.email;
            }
            ListBox.Items.Refresh();
        }
Example #2
0
        private void DodajButton_Click(object sender, RoutedEventArgs e)
        {
            Osoba   osoba        = new Osoba();
            UserDlg dodajUserDlg = new UserDlg();

            dodajUserDlg.osoba = osoba;
            if (dodajUserDlg.ShowDialog() == true)
            {
                osoba = dodajUserDlg.osoba;
                ListBoxItem newitem = new ListBoxItem();
                newitem.Content = osoba.imie + Environment.NewLine + osoba.nazwisko + Environment.NewLine + osoba.email;
                ListBox.Items.Add(newitem);
                lista.Add(osoba);
            }
            ListBox.Items.Refresh();
        }