WPF Management Console loses functionality after nulling content
I wrote an app with multiple views. View models are assigned to the "smartcontentcontrol" command, which is derived from contentcontrol and overrides the contentproperty metadata to handle the changed event for that dependency property. I am affecting this callback for visual effects (renderbitmap, etc.). I have now extended my viewmodel, so to reassign an object for the smartcontentcotrol content property, my viewmodel gets a reference to the smartcontentcontrol object. I have implemented this for my viewmodel to be able to close myself.
So - in xaml I have
<DataTemplate DataType="{x:Type viewmodel:MainViewModel}">
<view:MainView/>
</DataTemplate>
<SmartContentControl Content="{Binding MainView}"/>
in c # i am assigning this viewmodel view class this property
MainView = new MainViewModel();
-
at this point everything is going well and the view appears with the right data table. Not only that, but also my smartcontentcontrol triggers - I get a cool slide / fade animation - exactly what I was expecting - like the last one in the code calling this
MainView = null;
hides the "old" look with emptines. Everything is going fine! :) now the tricky part I can't figure out - As soon as I directly assign
smartcontentcontrol.content = null
Everything breaks down and the MainView assignment no longer changes the view or fires the onchanged event. It seems that data binding is gone. Why is this so? How can I solve this problem?
a source to share
No one has answered this question yet
Check out similar questions: