pjdupreez
pjdupreez

Reputation: 717

Catel DataWindow OK button does not close view

I have a DataWindow (MyWindow) with the OK Cancel and Apply buttons. Within this DataWindow is a View (MyView). For both MyWindow and MyView I have overridden GetViewModelType() like so:

protected override Type GetViewModelType()
        {
            return typeof(MyViewModel);
        }

I also have MyViewModel registered with MyWindow via the UIVisualizerService:

_uiVisualizerService.Register(typeof(MyViewModel), typeof(MyWindow));

On MyViewModel I have overridden ViewModelBase.Save():

protected override bool Save()
{
    if (HasErrors)
        return false;

    MyModel.SaveChanges();

    return base.Save();
}

I use this to display MyWindow:

var myViewModel = TypeFactory.Default.CreateInstanceWithParametersAndAutoCompletion<MyViewModel>();
            _uiVisualizerService.Show(myViewModel);

But when I click on the 'OK' Button of MyWindow, although the Save() method is called and base.Save() returns 'true', the Window is not closed.

If I open the MyWindow using,

new MyWindow().ShowDialog();

the 'OK' button works.

Am I missing something or doing something wrong? The Apply and Cancel Buttons work 100%

EDIT: I just noticed something, using Show() does not close the window when OK is clicked (as said above) BUT ShowDialog() does.

Is this correct?

Upvotes: 0

Views: 312

Answers (1)

pjdupreez
pjdupreez

Reputation: 717

Issue was fixed by updating to Catel v4.0.

Upvotes: 1

Related Questions