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

  • Home
  • SEARCH
  • 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 7079949
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T06:44:04+00:00 2026-05-28T06:44:04+00:00

I have a gridview in wpf and have a two radio buttons and a

  • 0

I have a gridview in wpf and have a two radio buttons and a button in template column. How do i access the status of radio buttons in the click event of the button?

 <DataGrid>
     <DataGrid.Columns>
        <DataGridTextColumn Binding="{Binding TrackingID}" Header="TrackingID" Visibility="Hidden" Width="50" />
        <DataGridTextColumn Binding="{Binding UserFullName}" Header="Name" Width="140" />                                       
        <DataGridTemplateColumn Width="350">
            <DataGridTemplateColumn.CellTemplate>
                <DataTemplate>
                        <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center" Orientation="Horizontal">
                            <RadioButton Width="50" Content="Yes" GroupName="status" />
                            <RadioButton Width="50" Content="No" GroupName="status" IsChecked="True" />
                            <Button Width="100" Click="Button_Click">View Details</Button>
                        </StackPanel>
                    </DataTemplate>
            </DataGridTemplateColumn.CellTemplate>
        </DataGridTemplateColumn>
     </DataGrid.Columns>
 </DataGrid>

I am capturing the event for the button in Button_Click() function. In this function i want to know which radio button has been selected.

private void Button_Click(object sender, RoutedEventArgs e)
        {                
                int trackingid = Convert.ToInt32((((FrameworkElement)sender).DataContext as DataRowView)[0].ToString()); //get the tracking id of the request

                //(((FrameworkElement)sender).DataContext as RadioButton) //not working

        }

Kindly help.

  • 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-28T06:44:05+00:00Added an answer on May 28, 2026 at 6:44 am

    If you don’t want to use binding (in case when your Yes/No is purely a UI property or by whatever reason, you still have an option. Give your RadioButtons names by using x:Name – smth. like “YesRadioButton” and “NoRadiOButton” and then:

    Call FinName("YesRadioButton") for the shared container (parent of your RadioButtons).

    or

    Use ElementName binding, i.e. bind your button’s tag to IsChecked of any of your RadiButtons

    <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center" Orientation="Horizontal">
     <RadioButton x:Name="YesRadioButton" Width="50" Content="Yes" GroupName="status" />
     <RadioButton x:Name="NoRadioButton" Width="50" Content="No" GroupName="status" IsChecked="True" />
     <Button Width="100" Click="Button_Click" Tag="{Binding ElementName='YesRadioButton', Path='IsChecked'}">View Details</Button>   
    </StackPanel>
    

    then in your button click simply inspect sender’s Tag property.

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

Sidebar

Related Questions

I have the following two GridViewColumns in a GridView in WPF: <GridViewColumn Header=Payment> <GridViewColumn.CellTemplate>
I have a simple WPF ListView with two columns defined. By default when you
I have been having trouble with the WPF DataGrid and listbox GridView performance when
I have a WPF ListView ( GridView ) and the cell template contains a
I have a gridview and I have a button on it.I want, if the
I have a GridView and SqlDataSource , I have a column type: DateTime .
I have a column in a gridview that has a hyperlink defined in each
I'm looking to set the background of a column in a WPF GridView. Many
I have following WPF ListView: <ListView Grid.Column=2 Grid.Row=1 Margin=0,53,12,6 Name=lvwProperties ItemsSource={Binding Path=SelectedPropertyItems, Mode=TwoWay} Grid.ColumnSpan=2>
I have WPF ListView with GridView view and I want to remove any trace

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.