showdialog

DialogResult problem in wpf

末鹿安然 提交于 2020-01-03 18:52:12
问题 I have a window that I open a few times as a ShowDialog. Every time I open it I use the new keyword in the first time i did: var myWindow = new MyWindow(); myWindow.ShowDialog(); second time I open it from the MyWindow View Model class: new MyWindow().ShowDialog(); in MyWindow code behind I have 2 events. one is when the user clcik ok and another when the user click cancel. void OnCancel(){ DialogResult = false; } void OnOk(){ DialogResult = true; } The events fires from the View Model class

DialogResult problem in wpf

蹲街弑〆低调 提交于 2020-01-03 18:51:54
问题 I have a window that I open a few times as a ShowDialog. Every time I open it I use the new keyword in the first time i did: var myWindow = new MyWindow(); myWindow.ShowDialog(); second time I open it from the MyWindow View Model class: new MyWindow().ShowDialog(); in MyWindow code behind I have 2 events. one is when the user clcik ok and another when the user click cancel. void OnCancel(){ DialogResult = false; } void OnOk(){ DialogResult = true; } The events fires from the View Model class

Set UpdateSourceTrigger to Explicit in ShowDialog (WPF MVVM)

假如想象 提交于 2019-12-30 03:24:08
问题 I saw this example - Binding.UpdateSourceTrigger Property in the example the UpdateSourceTrigger set to Explicit and then in the view code he call to UpdateSource of the TextBox name. But if i use the MVVM dp i dont want to have names to my controls and source properties are in the VM and not in the view so what is the right way to bind controls to VM properties and set the UpdateSourceTrigger to explicit? I want to do this because in my case its ShowDialog window and I want that the source

Modal Dialog not showing on top of other windows

余生颓废 提交于 2019-12-28 06:19:31
问题 I am using Window.ShowDialog() to open a modal window in my WPF (MVVM) application, but it lets me navigate to other windows using the Windows taskbar (Windows 7). Consider this: I have 3 non-modal windows open in my application. Now One of these opens a modal window using Window.ShowDialog() . I also set Application.MainWindow as the owner of the modal window. This is so because I am using MVVM messaging and the message handler to open a new window is centralized in App.xaml.cs . The window

Modal Dialog not showing on top of other windows

孤街醉人 提交于 2019-12-28 06:18:28
问题 I am using Window.ShowDialog() to open a modal window in my WPF (MVVM) application, but it lets me navigate to other windows using the Windows taskbar (Windows 7). Consider this: I have 3 non-modal windows open in my application. Now One of these opens a modal window using Window.ShowDialog() . I also set Application.MainWindow as the owner of the modal window. This is so because I am using MVVM messaging and the message handler to open a new window is centralized in App.xaml.cs . The window

How to show another window from mainwindow in QT

元气小坏坏 提交于 2019-12-28 01:56:05
问题 Platform: QT, Windows XP I am new to Qt. I want to show another window(what to do to open it as dialog) from mainwindow . I did " add New Item ->Qt Designer Form Class ", named it say MyWindow . But how to show this MyWindow from mainwindow ? 回答1: Implement a slot in your QMainWindow where you will open your new Window, Place a widget on your QMainWindow, Connect a signal from this widget to a slot from the QMainWindow (for example: if the widget is a QPushButton connect the signal click() to

Can I set ShowDialog() to not be topmost?

半城伤御伤魂 提交于 2019-12-24 05:48:23
问题 Is there a way I can set a ShowDialog() to not be topmost? I've looked at all the related SO questions, and none quite matched my situation. What I do is open a new WinForm from a datagridview button column. This new form pulls information from a few SQLite tables and allows the user to add information to the row the button was clicked. I open the WinForm using the code below. I use the ShowDialog() method so I can tell if the user saves the information in the form or cancels it. Pay_Bill

Why does closing a nested child dialog also close the parent dialog?

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-23 10:14:09
问题 I open a form as a modal dialog using ShowDialog. This dialog in turn allows another form to be opened as a modal dialog again using ShowDialog. When the innermost dialog is closed, this causes its parent dialog to close as well. Why does this occur and how can I prevent it? I have created a hello world version of the problem to illustrate this. Form 1: private void OpenForm2Button_Click(object sender, EventArgs e) { Form2 testForm = new Form2(); DialogResult dialogResult = new DialogResult()

WPF Routed Commands and ShowDialog Windows

喜你入骨 提交于 2019-12-21 06:17:58
问题 I was wondering how a window opened through ShowDialog is treated in the Visual Tree. For example, Window A opens Window B through a ShowDialog. When firing a routed command on Window B, Window A does not receieve the command (even though it is listening for it). Is there any way to make this work? Thanks! Jon 回答1: We run into this situation all the time in our application. We use the Window.Owner property and ICommandSource.CommandTarget property for this. For example, in Window A:

Windows Forms and ShowDialog problem

拟墨画扇 提交于 2019-12-19 02:51:12
问题 I have a borderless Windows Forms application. The main window creates other forms (simple dialogs where I can click yes or no) with ShowDialog() . Every created dialog is not visible in the taskbar, my application has only one taskbar entry that focuses my application (and if a dialog is open that one is focused). If I use ALT + TAB to cycle to all open windows I only see one entry, too. However, if the dialog is created while my application doesn't have the focus (for example the user