예제 #1
0
        private void Map1_MapSingleClick(object sender, MapClickEventArgs e)
        {
            Window window = new Window
            {
                Title                 = "Mark A Place",
                Content               = new PopupPromptUserControl(),
                SizeToContent         = SizeToContent.Height,
                Owner                 = Application.Current.MainWindow,
                WindowStartupLocation = WindowStartupLocation.CenterOwner,
                Width                 = 280
            };

            PopupPromptViewModel promptVM;

            window.DataContext = promptVM = new PopupPromptViewModel();
            promptVM.Confirm   = () => window.DialogResult = true;
            if (window.ShowDialog().Value)
            {
                PopupContentView popupContent = new PopupContentView();
                popupContent.DataContext = promptVM;

                Popup popup = new Popup();
                popup.Content  = popupContent;
                popup.Width    = 260;
                popup.Height   = 200;
                popup.Location = e.WorldCoordinate;
                Map1.Placements.Add(popup);
            }
        }
예제 #2
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            PopupPromptViewModel vm = DataContext as PopupPromptViewModel;

            vm?.Confirm?.Invoke();
        }