Hi,
I have a TabControl where a list of my view model objects are bound.
The ContentTemplate uses a UserControl:
<Setter Property="ContentTemplate">
<Setter.Value>
<DataTemplate>
<Grid Margin="-30,0,10,10">
<Views1:ControlUnitView Margin="10" />
</Grid>
</DataTemplate>
</Setter.Value>
</Setter>
I had expected that each tab item gets its own copy of the user control. This seems not to be the case. Instead only one user control is created but the data context is switched between each tab selection. Is this the expected behavior?
Within my user control, I have a grid. I want to copy the selected items from my view model to the SelectedItems property of the grid after the tab changed. I tried to use the datacontext-Changed event. However, when i set the SelectedItems list during this event, the items are not highlighted. But that's the only event I get within my user control. Is there a better way to accomplish this?
Thanks
Kind regards
Hartmut