Removing ViewModel in ViewFirst

Topics: Conventions, Framework Services
Jan 31, 2012 at 3:03 PM

Hi,

i am new to Cm, so please excuse me, when this sounds like a stupid question.

 

I am using the ViewFirst approach.

I am connecting the View  and ViewModel via cal:Bind.Model in the XAML of the View

Since WPF is controlling when the view is created and destroyed (I am using TagVisualisation from Surface SDK),

I was wonderiing if there is a way to for the View to Destroy it's ViewModel.

The TagVisualisation Class (my View)  has the lostTag event. When that get's fired, I want to destroy the ViewModel.

How can I do that?

Thanks for the help

Coordinator
Feb 1, 2012 at 3:16 PM

Try setting the Bind.Model property in code. Bind.SetModel(element, null)

Honestly, I'm not sure if that will work, but you can give it a try.