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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T03:16:17+00:00 2026-05-17T03:16:17+00:00

I have a WPF application that mostly follows MVVM, which I am trying to

  • 0

I have a WPF application that mostly follows MVVM, which I am trying to automate.

In some of my user controls I bind the Content property to the ViewModel of another user control. There is a data template defined which maps the ViewModel to the correct View to show on the screen.

This works fine for when the application is run by a user, but if I try to view the automation tree in UISpy or another tool, it always stops at the ViewModel.

I have found this problem in numerous places. Is there a way to tell the ViewModel to expose any automation properties beneath it in the tree? or am I defining the data template wrong?

Thanks in advance,
Donal

EDIT: Here is a sample XAML taken from the app. It is blocking accessing the automation tree. It is placed inside a RibbonWindow.

<TabControl Grid.Column="2" 
   cal:RegionManager.RegionName="{x:Static Regions:RegionNames.MainRegion}"  
   Name="tabControlMain" 
   SelectedValuePath="Name">
       <TabControl.Template>
          <ControlTemplate TargetType="TabControl">
              <Grid>
                <TabPanel IsItemsHost="True" Visibility="Hidden" />
                <Border BorderBrush="{DynamicResource BorderBrush}" Background="White" BorderThickness="1">
                    <framework:CachingContentPresenter 
                        ItemsSource="{Binding Items, ElementName=tabControlMain}" 
                        ContentTemplateSelector="{framework:MvvmTemplateSelector}"
                        ContentSource="SelectedContent" />
                </Border>
              </Grid>
          </ControlTemplate>
     </TabControl.Template>

Below is a previous version of the above XAML. It was allowing access to the automation tree:

<TabControl 
     Grid.Column="2" 
     Padding="0" 
     cal:RegionManager.RegionName="{x:Static Regions:RegionNames.MainRegion}"  
     Name="tabControlMain" 
     TabStripPlacement="Bottom" 
     SelectedValuePath="Name" 
     ItemContainerStyle="{StaticResource TabItemStyle}">
</TabControl>

Where the TabItemStyle is:

<Style TargetType="{x:Type TabItem}" x:Key="TabItemStyle">
   <Setter Property="Template">
      <Setter.Value>
          <ControlTemplate TargetType="TabItem">
          </ControlTemplate>
      </Setter.Value>
   </Setter>
</Style>
  • 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-17T03:16:18+00:00Added an answer on May 17, 2026 at 3:16 am

    I managed to find a solution to the XAML posted above. I’m not sure if it will work in all cases in our app, but I have yet to try them properly.

    Anyway, the fix was found in this post:
    http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/fa8eb86f-5001-4af6-adb3-ceb0799a0cf3/

    Basically, we added ‘Name=”PART_SelectedContentHost”‘ to the CachingContentPresenter in the ControlTemplate. From my understanding, this PART_ tells the parser/compiler to include the default behaviour of the control template such as mouse events and keyboard presses as well as Automation properties.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple WPF application which I am trying to start. I am
I have a WPF application that runs fine under XP as an administrator. When
I have written a WPF application that I want to port to Silverlight 2.
I have a simple message box in a WPF application that is launched as
I have a WPF application in VS 2008 with some web service references. For
Please help! Background info I have a WPF application which accesses a SQL Server
I have a very simple WPF application in which I am using data binding
I have a FlowDocument in a standard WPF application window where I have some
I have an application which requires 3.5 (not SP1.) My understanding is that SP1
I have a WPF application that runs as a service and renders 2D graphical

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.