I need to bind a property in my viewmodel to a property in a contentpane (IsEnabled for example). The following doesnt work, as I get an error that SetIsEnabledInTheVM is not a dependency property:
<igDock:TabGroupPane>
<igDock:ContentPane x:Name="contentPane">
<ContentControl>
<vm:MyViewModel SetIsEnabledInTheVM="{Binding ElementName=contentPane, Path=IsEnabled}" />
</ContentControl>
</igDock:ContentPane>
</igDock:TabGroupPane>
After some reading up, I think this should work if the VM is set as the datacontext of the ContentPane (or ContentControl?). But even if I do set the datacontext to my vm, I still dont see my view properly. Where should I be setting the datacontext here, and how do I then access the SetIsEnabledInTheVM property?
Thanks!
nicros said: I need to bind a property in my viewmodel to a property in a contentpane (IsEnabled for example). The following doesnt work, as I get an error that SetIsEnabledInTheVM is not a dependency property:
Or if you really want the VM to be hosted within a ContentControl that is within the ContentPane:
Actually I think my example property was bad. Im trying to get each tabs viewmodel to know whether it is the visible tab or not. I think the property in ContentPane that reflects this state is IsActivePane. But, this is a readonly property, so it seems I cannot bind to it in the way you describe- I get an error that says 'is read-only and cannot be set from the markup'.
I dont want to set IsActivePane, just make use of its value in my viewmodel.
Any way I can do this?