Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
435
Wpf Data Template instance of user control
posted

I have a XamTabControl with a few tabs. When tab is selected, I set the content of the tab to it's corresponding view model. Each view model is using the same user control, "BaseView"(which declared in a separate xaml and contains a XamDataGrid in it).

It's declared in the resources of the main xaml like this:

<DataTemplate x:Key="DocumentContentTemplate"  x:Shared="false">

      <v:BaseView DataContext="{Binding}" />

</DataTemplate>

And I use it in the XamTabControl in this way:

<igWindows:XamTabControl  Name="xamTabControl1" Grid.Row="1 "

ItemsSource="{Binding viewModels}" IsEnabled="True"

IsSynchronizedWithCurrentItem="True"

ContentTemplate="{StaticResource DocumentContentTemplate}">

 

Now my problem is that only one instance of the view is created for all the view model, although I used the attribute x:Shared="false" (as you can see in my example above).

 

Any suggestions?

Parents
No Data
Reply
  • 138253
    Offline posted

    Hello,

     

    It has been a while since you have made your post, in case you still need support I will be glad to assist you further. I suppose the other community members can benefit from this answer as well. I have been looking into your post, but I cannot be completely sure how your data is organized how you created view model, so if this is still an issue for you, could you please send me an isolated sample project, where this is reproduced, so I can investigate it further for you.

     

    Feel free to write me if you have further questions.

Children
No Data