0

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?

Tim Lloyd
  • 37,954
  • 10
  • 100
  • 130

1 Answers1

0

You'll need to write the infrastructure for this. I'm assuming ShowWindow is using Caliburn.Micro's WindowManager to display the window? In which case, you'll need to maintain a reference to each window that is open. Is this parent/child relationship requirement just for the purpose of closing all children when the parent is closed? One option would be to implement your own Conductor type which maintains a list of open windows, and your own IScreen/Screen types which maintain parent/child relationship state.

devdigital
  • 34,151
  • 9
  • 98
  • 120