0

i've two content controls how can i share a common property between them, for example if i select some value from combobox in the first content control, how can the second control know it

<telerikNavigation:RadTabItem Header="1">
    <StackPanel>
        <ContentControl Content="{Binding EGRPExtractViewModel.View}" />                    
    </StackPanel>
</telerikNavigation:RadTabItem>
        <telerikNavigation:RadTabItem Header="2">
        <ContentControl Content="{Binding EGRPRightObjectViewModel.View}" />
</telerikNavigation:RadTabItem>

Thanks

user3916810
  • 43
  • 1
  • 8

2 Answers2

0

You need to use two way binding then respond to the property changing in your ViewModel.

<ContentControl Content="{Binding EGRPRightObjectViewModel.View,Mode=TwoWay}" />

See the MSDN docs for how to respond to changed properties: http://msdn.microsoft.com/en-us/library/ms743695(v=vs.110).aspx

embee
  • 1,007
  • 7
  • 15
0

You do not bind view properties. You can bind control properties in same view, so one possibility for you will be to create a control which exposes bindable properties specifically for this reason.

When using mvvm normally view-model should provide all needed properties to the view. If it's a property from another view-model, then it is still have to be provided by view-model of this view (search for questions about how to pass data between view-models to example, here is one).

Community
  • 1
  • 1
Sinatr
  • 20,892
  • 15
  • 90
  • 319