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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T13:08:16+00:00 2026-06-03T13:08:16+00:00

I have an ItemsControl defined as shown below. Basically, I have a list of

  • 0

I have an ItemsControl defined as shown below. Basically, I have a list of editors (EditorList) and I want hyperlinks for each. However, my open command (OpenEditorCommand) property is at the same level as the list of editors. How do I refer to that property when the context is set to the item within the list. I’ve tried working with the RelativeSource method but it’s too convoluted for me to understand. Am I on the right track?

<ItemsControl ItemsSource="{Binding EditorList}">
   <ItemsControl.ItemTemplate>
      <DataTemplate>
         <TextBlock Margin="2,6" HorizontalAlignment="Center">
            <Hyperlink Command="{Binding RelativeSource={RelativeSource AncestorType=ItemsControl, AncestorLevel=2, Mode=FindAncestor}, Path=OpenEditorCommand}" CommandParameter="{Binding Name}">
               <StackPanel>
                  <Image Source="{Binding Image}" Width=32/>
                  <TextBlock Text="{Binding Path=Name}"/>
               </StackPanel>
            </Hyperlink>
         </TextBlock>
      </DataTemplate>
   </ItemsControl.ItemTemplate>
</ItemsControl>
  • 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-03T13:08:18+00:00Added an answer on June 3, 2026 at 1:08 pm

    You only need to set the AncestorLevel in cases where there is possibly more than one ancestor of the searched type existing in the element tree. The default value is 1 which mean find the closest.

    But you need to specify in the Path that you want to bind to the OpenEditorCommand on the DataContext of the ItemsControl:

    Command="{Binding Path=DataContext.OpenEditorCommand, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an ItemsControl bound to a list of objects. It basically displays a
I have an ItemsControl with a DataTemplate that has been defined. My ItemsControl definition
I have an ItemsControl that is bound to a collection of objects. Each object
I have a list of textual descriptions, each of which a user must score
I have a listbox defined like this: <ListBox.ItemTemplate> <DataTemplate> <ItemsControl> <!-- Contents here -->
I have a Prism (CAL) shell with defined regions. Each region is responsible for
I have an ItemsControl containing a list of data that I would like to
On my code i have itemsControl and i want to filter the items that
I wrote some controler that have itemsControl. Each item in the control is some
I have the next problem. I have a ItemsControl defined with xaml. <Grid> <Grid.RowDefinitions>

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.