A user clicks on menu item and a child window is shown (non-modal). How do I prevent user to not open the same window again?
I know I can handle initialize and Closed events of the child window to add.remove it to some collection of opened child windows, but I am looking at the pure and clean MVVM way.
I think you should add one property to your view model class to handle visibility of a view, then bind it to your view. Inside setter section of you property check if its value is changed, if not just return.
You don't need to create a lot of child windows in your application, just control the visibility of existing one and change the data you want to show.
Related
After looking at the documentation, I'm able to persist state in the following two cases:
When a WebviewPanel is hidden (ie, the user switches tabs) using getState/setState
When the user restarts the VS Code by implementing a WebviewPanelSerializer
However, I don't see a way to persist state when the panel is destroyed (ie, the user closes it or calls dispose). Here's my scenario:
I execute a command to show the WebviewPanel
I have an input box in the HTML content. I type some string in and press a button to save it. Upon saving, I save it using setState and then append a div with the entered text into the webview.
I close the panel and execute the command again. The panel does not have the appended div.
You have 2 options:
Recreate the additional div when you find saved state (e.g. the input from the user).
Use retainContextWhenHidden to keep the content of the webview, even if it is moved to the background.
The latter won't help when the user closed the webview, however, and is much more resource hungry than the state save/restore operation.
I have two forms. The first one has a TToolBar and two TToolButton. The second one inherits the first one and has three more TToolButton.
I change the order of the buttons in design time, putting the three buttons of the second form before the buttons of the first form. When the application is running, the buttons of the second form appear after the buttons of the first form.
Is there a way to use the order set in design time?
No, there is no way to override the position of buttons inherited from the ancestor form. Buttons on a TToolBar are contained in a simple TList and are added in the order that they are created. They are created in the order that they appear in the .dfm file and, when inheriting a form, the ancestor's controls are always created and added first.
Even if you reorder the buttons at design time, save the form, and then close and re-open it the layout will only preserve the ordering changes to the descendent form's toolbar buttons with the ancestor buttons reappearing at the beginning again.
This is a limitation of the TToolBar class itself. Your options are to either write a custom toolbar or to manage the button arrangement programmatically.
I have a user control defined in a separate project (To reuse) which has two comboboxes and a button. I will be using this user control in other projects. The user control has a view model class. This view model class handles selected item changed in the combobox and also has a command delegate to handle the button click.
Now my question is when I use this user control within another control in another project I want an event to be raised within this owning control as well whenever a new item is selected in the combobox. Also, when a button is clicked in the resuable control I want that event to be raised in my owning control as well so that I can execute some additional logic. Can somebody suggest which is the best way to handle this?
Thanks,
Ranjith
I'm using a RadGrid for changing record status's. Users have the ability to select a status from a dropdown and update that record with that status. Depending on the status chosen, when the user clicks update I want to popup an additional form so the user can fill out more data required for the update. I'm not sure the best way to go about implementing this. Any suggestions are appreciated.
One way is to use the RadWindow like a modal and pop it up to the user via client-side JavaScript. We use RadWindows in our applications and it works. Or, the RadWindow supports a Nested Grid or View that you can have as a record's child; so you can have the master record, click on the arrow on the left and expand the record to view a nested grid of data, or a custom view (via the NestedViewTemplate property). You can also have the form in a DIV, hide it, then show it via JavaScript too.
Those are two ways.
HTH.
I have created a very simple wpf app with mvvm light.
I have rows in a list view, these are templated representations of Book objects.
I can click a row, then click an edit button, this button loads a new window and sends the new window the book to edit (using mvvm-light's Messenger).
The issue I have is when I edit the record in my new window the data on the main form is updated. The text boxes are bound to the object received via the Messenger.
I know this is because I have essentially passed a reference to the same Book object around the place, therefore I update in one place.. and voilĂ it updates on the main page too.
What I would like to know is.. is there a standard way/method/concept to achieve what I am trying to do? i.e. create an "edit" page/screen with the option of discarding the edits?
thanks.
Could you make your entity implement ICloneable and create a clone for editing?