This is a migrated thread and some comments may be shown as answers.

RadWindow in MVVM

3 Answers 175 Views
Window
This is a migrated thread and some comments may be shown as answers.
Stefan Buys
Top achievements
Rank 2
Stefan Buys asked on 18 Mar 2011, 03:41 PM
Hi,

I am using a RadWindow as UserControl as per this documentation

I am having some difficulty in using it with MVVM. I have a ShellView (which is my RootVisual) and it has a ShellViewModel.cs class supporting it. I also gave my RadWindow a ViewModel to control its behavior, etc.

I need to be able able to show my RadWindow in the form of a dialog window when the application starts up, presumable from the ShellViewModel, but I have no idea how to do this! Any ideas will be welcome!

Stefan

3 Answers, 1 is accepted

Sort by
0
Accepted
George
Telerik team
answered on 18 Mar 2011, 05:47 PM
Hello Stefan,

 
Do you use PRISM? If you do, please refer to the attached project. 

Please do not hesitate to contact us if you require any further information.

Greetings,
George
the Telerik team
0
Stefan Buys
Top achievements
Rank 2
answered on 22 Mar 2011, 10:30 PM
Hi George,

Yes, I am using Prism and thanks for the sample, it solved my initial problem. Is it a good idea to use the RadWindow as base class for a view managed by a ViewModel? Also, I have not included a region or content control for the content, is this also acceptable practice?

Another issue I have is that the RadWindow's KeyPress event is required to be handled in the ViewModel. It is expected behavior for the user to press the Enter key once he/she filled in the Username and Password. I know that Prism only support Click events and that custom commands can be developed, but I am not sure if/how to make it work for RadWindow. I have also looked at the Expression InvokeCommand and other Triggers, but I can't seem capture a Enter keypress in my ViewModel. 

Please advise,
Stefan
0
Accepted
George
Telerik team
answered on 28 Mar 2011, 09:25 AM
Hi Stefan Buys, 


Straight to your questions:
  • I cannot say if this is a good idea or not. The most important is to suits your needs. If it does, then go ahead.
  • You could use InputBindings. The idea is to bind the KeyPress event to a command in your view. 

I hope this helps.

Best wishes,
George
the Telerik team
Tags
Window
Asked by
Stefan Buys
Top achievements
Rank 2
Answers by
George
Telerik team
Stefan Buys
Top achievements
Rank 2
Share this question
or