RadWindow in MVVM

4 posts, 2 answers
  1. Stefan Buys
    Stefan Buys avatar
    22 posts
    Member since:
    Dec 2009

    Posted 18 Mar 2011 Link to this post

    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

  2. Answer
    George
    Admin
    George avatar
    1332 posts

    Posted 18 Mar 2011 Link to this post

    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
  3. DevCraft banner
  4. Stefan Buys
    Stefan Buys avatar
    22 posts
    Member since:
    Dec 2009

    Posted 22 Mar 2011 Link to this post

    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
  5. Answer
    George
    Admin
    George avatar
    1332 posts

    Posted 28 Mar 2011 Link to this post

    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
Back to Top