Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7521795
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T02:19:59+00:00 2026-05-30T02:19:59+00:00

I want to use MVVM in an application where the different pages are TabItems.

  • 0

I want to use MVVM in an application where the different pages are TabItems.

For this I use an observable collection of my view models (Items) and bind it to the tabcontrols ItemSource.

For each view model, I created an individual data template to render the correct view like this:

<DataTemplate DataType="{x:Type baseVm:AViewModel}">
  <baseVw:AView /> 
</DataTemplate>

To display the correct name in the tab’s header I created another data template to be applied to each of the tab control’s elements:

<DataTemplate x:Key="ViewModelTabTemplate">
  <DockPanel>
    <ContentPresenter Content="{Binding Path=Name}"/>
  </DockPanel>
</DataTemplate>

The tab control looks like this:

<TabControl x:Name="myTabControl" 
            ItemsSource="{Binding Items}" 
            ItemTemplate="{DynamicResource ViewModelTabTemplate}">
</TabControl>

What I want to do now is to enable/disable tabs from within the view model that contains the collection. The view model’s base class contains a dependency property IsEnabled and I would like to bind this to the views. If I do this directly in the view like this:

IsEnabled="{Binding IsEnabled, FallbackValue=true}"

the tab page’s content gets disabled when I turn the IsEnabled property to false. But what I really want is to also disable the tabpage’s tab and not just the content.

Thanks for any help!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T02:20:01+00:00Added an answer on May 30, 2026 at 2:20 am

    Maybe you could try something like this –

    <TabControl>
        <TabControl.ItemContainerStyle>
            <Style TargetType="{x:Type TabItem}">
                 <Setter Property="IsEnabled" Value="{Binding IsEnabled}"/>        
            </Style>
        </TabControl.ItemContainerStyle>
    </TabControl>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can I use UnityContainer in View's codebehind when I want to write good MVVM
I want use MVVM design pattern in WPF and Silverlight Application. Where can i
How to use MVVM in WPF Browser Application? I want to know how to
When writing a WPF application using MVVM, I want to use a WCF service,
I am new in MVVM. I just learn this pattern and want to use
I want use JQuery mobile for the front-end of my mobile application, but I
I have an application where you can open many different items (like in excel
I'm writing an application in WPF using the MVVM-pattern and will really often use
So, i'm building my first SL application. I tried to use the MVVM approach,
I'm trying to use Prism and the MVVM pattern to develop an application. In

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.