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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T02:27:50+00:00 2026-05-14T02:27:50+00:00

I got: <ListView.View GridViewColumnHeader.Click=ColumnHeaderClick> <GridView> <GridViewColumn x:Name=Col Header=Item> private void ColumnHeaderClick(object sender, RoutedEventArgs e)

  • 0

I got:

   <ListView.View GridViewColumnHeader.Click="ColumnHeaderClick">
      <GridView>
          <GridViewColumn x:Name="Col" Header="Item">   



   private void ColumnHeaderClick(object sender, RoutedEventArgs e)
     {
        GridViewColumnHeader headerClicked = e.OriginalSource as GridViewColumnHeader;

     }

Now, how to get the x:Name value of GridViewColumn in the method? I can’t put ‘Name’ property for the column in xaml, and it comes like empty string in runtime. Although I am able to get the header, still need to get x:Name value.

  • 1 1 Answer
  • 1 View
  • 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-14T02:27:50+00:00Added an answer on May 14, 2026 at 2:27 am

    When you use the x:Name syntax on an element that isn’t a FrameworkElement or FrameworkContentElement, it registers the element with a NameScope. Unfortunately, you can’t retrieve the name for an element, the lookup only works the other way around.

    If you need to pass additional information about the DataGridColumn, a custom attached property would be an easy way of doing it.

    More information about x:Name can be found on MSDN. Also, the NameScope documentation describes its behavior.

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

Sidebar

Related Questions

<ListView x:Name=lstProductionOrders> <ListView.View> <GridView> <GridViewColumn Header=Production Order:/> ... I've set the fontsize on the
I got a combobox in the grid's column: <ListView> <ListView.View> <GridView> <GridViewColumn> <GridViewColumn.CellTemplate> <DataTemplate>
I got a ListView in WPF with a GridView as view. I wanted to
I've got a ListView object, with a GridView within it, where I'll be putting
In my View I got a ListView bound to a CollectionView in my ViewModel,
I've got a WPF ListView/GridView spec'd in XAML. The first column uses a CellTemplate
I've got a ListView and, for View = List, would like to have the
I am trying to build an Android View, with a listview as a header
I got in to weird problem, I can't click on my list view... I
i have got ListView of Inbox SMS.I am trying, if i click on any

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.