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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T15:35:50+00:00 2026-06-02T15:35:50+00:00

Using the following XAML how can I retrieve the value of let’s say <TextBlock/SenderName>

  • 0

Using the following XAML how can I retrieve the value of let’s say <TextBlock/SenderName> or any other control nested in the stackpanel depending on the listview current selected item? in C#

XAML

<ListView x:Name="ItemListView"  
      ItemsSource="{Binding}"
      Margin="1041,120,85,68" SelectionChanged="ListView1_SelectionChanged">
    <ListView.ItemTemplate>
        <DataTemplate>
            <StackPanel>
                <TextBlock Text="{Binding SenderName}" 
                   FontSize="20" Margin="15,0,0,0" HorizontalAlignment="Right" />
                <TextBlock Text="{Binding Value}"  
                   FontSize="18" Margin="5,0,0,0" TextWrapping="Wrap" HorizontalAlignment="Right" />
                <TextBlock Visibility="Collapsed" Text="{Binding StreamId}" />
                <TextBlock Text="{Binding DateTime}" 
                   FontSize="16" Margin="15,0,0,0" HorizontalAlignment="Right" />
            </StackPanel>
        </DataTemplate>
    </ListView.ItemTemplate>
</ListView>
  • 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-02T15:35:53+00:00Added an answer on June 2, 2026 at 3:35 pm

    If you’re using a MVVM approach then your ListView’s ItemsSource is bound to a property on your ViewModel. To gain access to values from the ListBox’s SelectedItem bind the SelectedItem to another member on your view model. Something like:

    Code:

    public class ViewModel
    {
        public ObservableCollection<MyListViewItem> Items {get;set;}
        public MyListViewItem SelectedListItem {get;set;}
    }
    

    XAML:

    <ListView DataContext="{Binding Path=myViewModel}" 
         ItemsSource="{Binding Path=Items}"
         SelectedItem="{Binding Path=SelectedListItem}" />
    

    If you’re looking to do it from the code-behind, you can access the SelectedItem member of ItemListView which should be the object the currently selected item is bound to.

    Finally, if you want to bind to the control from another control you can access it using ElementName and SelectedItem

    <TextBlock Text="{Binding ElementName=ItemListView, Path=SelectedItem.SenderName}"/>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using the following XAML how can I get a reference to the selected radiobutton
I was using the following xaml in wpf: <Style TargetType={x:Type Border}> <Setter Property=BitmapEffect> <Setter.Value>
I have a Pivot control which I am using as following within the XAML.
I am using the following arrays as parameters to my value converter. I can't
I have the following XAML that displays a cover image for a book using
I'm creating a windows 8 application (but I suspect that any one using Xaml
Using following code I try to get updated list of checkbuttons' corresponding text values,
I using following code: var search = 'test'; if ($('#sku').find(search) ){ //alert(search); $(document).find(search).css('color','red'); <TABLE>
I am using following storedprocedure set ANSI_NULLS ON set QUOTED_IDENTIFIER ON GO Alter PROCEDURE
I am using following code in rowdatabound function. Protected Sub gvwMileStone_RowDataBound(ByVal sender As System.Object,

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.