DialogService and OnDialogOpened #2569
Replies: 3 comments 1 reply
-
This allows you to set and bind your properties before the view is fully loaded to prevent the "refresh" appearance of bindings when the view loads. The bigger logic question would be why are you trying to close a dialog the second it opens. |
Beta Was this translation helpful? Give feedback.
-
Hi Brian, I think it is great to have the opportunity to set the bindings before the view is fully loaded, and we definitely use this. I was just wondering about the naming "opened" as I would expect this to be after the dialog was opened. The reason why we are trying to close the dialog again, is that, we prompt the user for at filename when entering the dialog view, and if this user cancels the openfiledialog, then we also cancels our dialog as well. Ideally we would prompt the user after the dialog was loaded, but as we are "just" IDialogAware, we used the OnDialogOpened method to accomplish this. So we just thought it could be nice to also have some kind of indication, in the viewmodel, that we are "good to go" interacting with the user. Hopes this do give you some idea of our intentions ;-) |
Beta Was this translation helpful? Give feedback.
-
Hi Brian, That could be a solution:-D but not in our scenario. I think we will just create our own DialogService, and override ConfigureDialogWindowEvents, and in the loadedHandler we will call OnDialogOpened. And in ConfigureDialogWindowContent, I will just call "OnDialogOpening" (Previously OnDialogOpened) on the extended IDialogAware interface. I think this could be a more precise naming. ;-) But thanks for taking the time to answer this :-) |
Beta Was this translation helpful? Give feedback.
-
Hi,
I have a question regarding the time when RequestClose i set in the dialogService versus its state in OnDialogOpened.
When we enter OnDialogOpened, in the viewmodel, I can see that RequestClose has not yet been set?? Which makes it difficult to close down the view inside this method (I any needs for that is required).
I can see that RequestClose is set in the Windows loaded event, wouldn't it be better to call the viewmodels "OnDialogOpened" method in the loaded event as well? Today it seems that the OnDialogOpened is called before the windows is loaded, which makes me think that it perhaps should be called "OnDialogOpening" as it happens before it is opened ;-)
Are there any reasons for the current logic?
Best regards
Dennis
Beta Was this translation helpful? Give feedback.
All reactions