Parent and child model interaction

Posted by jminarik on Stack Overflow See other posts from Stack Overflow or by jminarik
Published on 2010-12-26T16:34:45Z Indexed on 2010/12/27 0:54 UTC
Read the original article Hit count: 166

Filed under:
|
|

Hi, is it possible set something like wpf window owner in caliburn.micro ?

I have PARENT VIEW MODEL, from this model I open CHILD SCREEN {VIEW MODEL} with this method:

    public IEnumerable<IResult> Open()
    {

        yield return new ShowWindow("ChatScreen")
            .InitializeWith(_service
            .DetailData(Account, _selectedFriend.Value.Nick),
            AvatarImage);
    }

This method create a new WPF WINDOW - CHILD SCREEN and initialize CHILD VIEW MODEL with some variables.

I would like set something like this CHILD_SCREEN.PARENT = PARENT_VIEW_MODEL.

I would like achieve if I close PARENT VIEW MODEL that it close also all CHILD MODELS.

Also it exist way how can I check if screen, in my situation WPF window, is active/inactive from MAIN VIEW MODEL?

© Stack Overflow or respective owner

Related posts about wpf

Related posts about mvvm