コード例 #1
0
        void Add()
        {
            var p = new Person();

            var dlg = new PersonEditDialog
            {
                DataContext           = p,
                Owner                 = Application.Current.MainWindow,
                WindowStartupLocation = WindowStartupLocation.CenterOwner
            };

            if (dlg.ShowDialog() == true)
            {
                People.Add(p);
            }
        }
コード例 #2
0
        public void Edit()
        {
            if (SelectedPerson == null)
            {
                return;
            }
            var p   = SelectedPerson.Clone();
            var dlg = new PersonEditDialog
            {
                DataContext           = p,
                Owner                 = Application.Current.MainWindow,
                WindowStartupLocation = WindowStartupLocation.CenterOwner
            };

            if (dlg.ShowDialog() == true)
            {
                SelectedPerson.Copy(p);
            }
        }