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 8094277
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T20:45:02+00:00 2026-06-05T20:45:02+00:00

I have a TabControl with templated content as below: <TabControl x:Name=Items SelectedItem={Binding ActiveItem} TabStripPlacement=Left

  • 0

I have a TabControl with templated content as below:

<TabControl x:Name="Items" SelectedItem="{Binding ActiveItem}" TabStripPlacement="Left" Grid.Column="0" Grid.ColumnSpan="2" Grid.Row="1">
    <TabControl.ItemContainerStyle>
        <!--Some style stuff-->
    </TabControl.ItemContainerStyle>
    <TabControl.Template>
        <ControlTemplate TargetType="{x:Type TabControl}">
             <!--Some structure stuff including a tabpanel and contentPresenter-->
        </ControlTemplate>
     </TabControl.Template>
     <TabControl.ContentTemplate>
         <DataTemplate>
              <Button x:Name="MyButton" Visibility="{Binding x}" />
         </DataTemplate>
     </TabControl.ContentTemplate>
</TabControl>

The view containing this TabControl uses a ViewModel similar to this:

public class MyPageViewModel : ScreenConductorViewModelBase<IMyTab>
{
    public Visibility x = Visibility.Hidden;
}

I would like the visibility of the button inside the template to pull from my parent(?) ViewModel, however its trying to retrieve x from the items viewModel.

This makes sense to me but Im not sure how to specify that this field should come from the parent instead.

I’ve tried a few things but none of them seem to work:

   {Binding x}
   {Binding DataContext.x}
   {Binding RelativeSource={RelativeSource TemplatedParent}, Path=x}

Im sure it must be simple to do this but I cant seem to work out the binding syntax

  • 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-06-05T20:45:04+00:00Added an answer on June 5, 2026 at 8:45 pm

    Try

    <Button x:Name="MyButton"
            Visibility="{Binding RelativeSource={RelativeSource AncestorType={x:Type TabControl}},
                                 Path=DataContext.x}" /> 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a tab content template set to my tab control: <TabControl SelectedIndex=0 ItemsSource={Binding
I have a border that contains a TabControl in a HeaderedContentControl: <Border Grid.Column=1 Style={StaticResource
I have created a TabControl in a WPF application I'm writing. I re-templated TabItem
I have a heavily templated TabControl - similar in design to the Scrollable Tab
So I have created my own TabControl and TabItem templates (both with x:Name attribute),
I have a TabControl, and on the second tab is a button: <Button Name=deleteResourceBtn>
I have a TabControl with dynamically created tabs and content that vary depending on
I have a TabControl and users controls are in TabItem content like that: \\...
I have TabControl. I added it to tabpages. To one of them(tpTags) I dynamically
I have a TabControl in my XAML which is just an empty control as

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.