Beispiel #1
0
        private void AddChild_Click(object sender, RoutedEventArgs e)
        {
            var dlg             = new BoSelector();
            var childController = new EditableListSelectorController(dlg, typeof(UiMaterial));

            //childController.Setter = controller.AddMaterial;
            childController.Setter = AddMaterial;
            dlg.DataContext        = childController;
            dlg.ShowDialog();

            // refresh
            // get row statuses
            var gridStatus = new Queue <bool>();

            GetGridStatus(detailGrid, gridStatus);
            //DumpVisualTree(detailGrid);
            var mainSelection = mainGrid.SelectedItem;

            mainGrid.SelectedItem = null;
            Application.Current.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Background, new Action(delegate { }));
            mainGrid.SelectedItem = mainSelection;
            Application.Current.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Background, new Action(delegate { }));
            // set row statuses
            SetGridStatus(detailGrid, gridStatus);
        }
Beispiel #2
0
        void ctrlForeignKey_Click(object sender, RoutedEventArgs e)
        {
            if (dataSourceGrid.SelectedItem == null)
            {
                return;
            }

            var button = sender as Button;

            Debug.Assert(button != null && button.Tag is ForwardKeyInfo);
            var forwardKeyInfo = button.Tag as ForwardKeyInfo;

            var dlg             = new BoSelector();
            var childController = new EditableListSelectorController(dlg, forwardKeyInfo.UiType);

            //childController.Setter = x => (button.DataContext as DefaultCustomController).SelectedItem.GetType().GetProperty(propName).SetValue(button.DataContext, x);
            childController.Setter = x => SetForwardProperty(forwardKeyInfo, x);

            dlg.DataContext = childController;
            dlg.ShowDialog();
        }