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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T11:01:33+00:00 2026-05-26T11:01:33+00:00

I am facing problem and would be glad if you could help . So,I

  • 0

I am facing problem and would be glad if you could help .
So,I am binding “Listview” to “Feeds” object which is a FeedViewModel object.

But at some point ,I want to show some data which isn’t present in the FeedViewModel object but is present in the MainViewModel object.
In my case,for ex-i want to display the URL for every feed but the URL isn’t being extracted from the Xpath extraction of source but being passed from the MainViewModel object which I have shown in code by MainViewModel.Url.

But in my XAML,all the children of the Listview look only in the “Feeds” object which is creating a problem.

 <ListView Grid.Row="3" Margin="5" ScrollViewer.HorizontalScrollBarVisibility="Disabled" ScrollViewer.VerticalScrollBarVisibility="Auto" HorizontalContentAlignment="Stretch" ItemsSource="{Binding Feeds}">
        <ListView.ItemTemplate>
            <DataTemplate>
                        --------------some code --------------
                        <Label Margin="4">Critic:</Label>
                        <Label Grid.Column="1" Content="{Binding Creator}" Margin="4" />
                        <Label Grid.Row="1" Margin="4">Title:</Label>
                        <Label Grid.Column="1" Grid.Row="1" Content="{Binding Title}" Margin="4" FontWeight="Bold" />
                        <Label Grid.Row="2" Margin="4">Location:</Label>
                        <Label Grid.Column="1" Grid.Row="2" Content="{Binding **MainViewModel.Url**}" Margin="4" />
                        <Label Grid.Row="3" Margin="4">Date:</Label>
                        <Label Grid.Column="1" Grid.Row="3" Content="{Binding Date}" Margin="4" />
                        <Label Grid.Row="4" Margin="4">Rating:</Label>
                        <Label Grid.Column="1" Grid.Row="4" Content="{Binding Rating}" Margin="4" />
                        <Label Grid.Row="5" Margin="4" HorizontalAlignment="Stretch">Description:</Label>
                        <TextBlock Grid.Column="1" Grid.Row="5" TextWrapping="Wrap" ScrollViewer.VerticalScrollBarVisibility="Auto" Text="{Binding Description}" Padding="4" Margin="4" />
                    </Grid>
                </Border>
            </DataTemplate>
        </ListView.ItemTemplate>
    </ListView>

Can someone suggest what can be done?

Gaurav

  • 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-26T11:01:34+00:00Added an answer on May 26, 2026 at 11:01 am

    The DataContext is changed to the templated item, to get to the main viewmodel you can target a parent’s DataContext using RelativeSource, e.g.

    <Label Grid.Column="1" Grid.Row="2"
           DataContext="{Binding DataContext, RelativeSource={RelativeSource AncestorType=ListView}}"
           Content="{Binding Url}" Margin="4" />
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am facing a problem in my Spring learning and would need some help.
I'm facing a problem that I assumed would be very easy to solve but...
I’m currently facing a design problem and would appreciate advice on how I could
I am facing a problem. I would like to localize my action names in
I'm facing this problem again and again, but can't find any solution (except mine,
I am currently facing the problem to check whether a property of an Object
We are facing one problem in managing test data (xmls which is used to
I'm fixing a program but I'm facing a problem and I cant really realize
I'm facing a simple problem I would like to get a local path from
I'm playing with kretprobes and I am facing a problem. I would like, 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.