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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T20:26:38+00:00 2026-05-23T20:26:38+00:00

I am new to WPF, so there may be an easy answer to this,

  • 0

I am new to WPF, so there may be an easy answer to this, but it isn’t obvious to me.

The grid obviously represents a collection of my Configured Port objects. I want to store the Configured Port object (which is the Binding for each row) in order to pass it to the next UserControl in the MVVM chain when a grid cell is clicked.

I did find this SO question, but the commented section is exactly what I am missing.

Thanks in advance, I’m sure there is an easy solution.

  • 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-23T20:26:39+00:00Added an answer on May 23, 2026 at 8:26 pm

    I would use this (everything except for the inner most xaml was taken from the other SO post you linked to:

    <DataGrid ItemsSource="{Binding}" AutoGenerateColumns="False" >
       <DataGrid.Columns>
            <DataGridTemplateColumn Header="Custom Column">
                <DataGridTemplateColumn.CellTemplate>
                    <DataTemplate>
                        <Button Tag="{Binding}" Content="Click Me" Click="Button_ClickHandler"/>
                    </DataTemplate>
                </DataGridTemplateColumn.CellTemplate>
            </DataGridtemplateColumn>
        </DataGrid.Columns>
    </DataGrid>
    

    Then the source for the click handler:

    private void Button_ClickHandler(object sender, EventArgs e)
    {
        var clickedConfiguredPort = ((FrameworkElement)sender).Tag as ConfiguredPort;
        DoStuff(clickedConfiguredPort);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

(I'm pretty new to WPF, so this question may seem obvious or inconsistent.) There
This seems really easy, but it's definitely not working as expected. In WPF 4.0,
Hello there and Merry Christmas !!! I am new to WPF and I am
being new to WPF this is a complex problem for me. What i want
I have a WPF Grid with a XAML similar to this: <Grid width=200 Height=200
I started a new WPF project in VS2008 and then added some code to
While designing a new WPF application I noticed exceptions not being thrown during data
Doing the below will reproduce my problem: New WPF Project Add ListView Name the
New to wpf and through a learning curve. I have a userControl with a
New to wpf and therefore struggling a bit. I am putting together a quick

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.