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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T13:24:11+00:00 2026-06-13T13:24:11+00:00

I am using a DataGrid in my Silverlight project which contains a custom checkbox

  • 0

I am using a DataGrid in my Silverlight project which contains a custom checkbox column. I have bound its Command property to a property of my ViewModel class. Now, the problem is that I want to send the “selected item” of DataGrid through the command parameter for which I have written the following code :

<sdk:DataGrid AutoGenerateColumns="False" Margin="10,0,10,0" Name="dataGridOrders" ItemsSource="{Binding OrderList}" Height="190">
    <sdk:DataGrid.Columns>
        <sdk:DataGridTemplateColumn Header="Select">
            <sdk:DataGridTemplateColumn.CellTemplate>
                <DataTemplate>
                    <CheckBox>
                        <is:Interaction.Triggers>
                            <is:EventTrigger EventName="Checked">
                                <is:InvokeCommandAction Command="{Binding Source={StaticResource ExecutionTraderHomePageVM},Path=OrderSelectedCommand,Mode=TwoWay}"
                                                        CommandParameter="{Binding ElementName=dataGridOrders,Path=SelectedItem}" />
                            </is:EventTrigger>
                            <is:EventTrigger EventName="Unchecked">
                                <is:InvokeCommandAction Command="{Binding Source={StaticResource ExecutionTraderHomePageVM},Path=OrderSelectedCommand,Mode=TwoWay}"
                                                        CommandParameter="{Binding ElementName=dataGridOrders,Path=SelectedItem}" />
                            </is:EventTrigger>
                        </is:Interaction.Triggers>
                    </CheckBox>

But I am always getting null in the parameter of my command’s Execute method. I have tried with other properties of DataGrid such as Width, ActualHeight etc. but of no use. What am I missing here?

  • 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-13T13:24:12+00:00Added an answer on June 13, 2026 at 1:24 pm

    The problem here is one of name-scoping. In short, the XAML inside a DataTemplate has its own ‘namescope’ and can’t see any names outside of it. In particular, it won’t be able to find the parent DataGrid as that lies outside the DataTemplate.

    I’m not sure why you’re listening out to checked and unchecked events and firing commands based on them. It’s not entirely clear what you’re trying to achieve. Instead, I would use a two-way binding to bind the IsChecked property of the CheckBox to a bool property in your (row-level) view-model class, and call the command functionality from this bool property’s setter. You can get hold of the selected item by binding a view-model property to the DataGrids SelectedItem property with a two-way binding.

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

Sidebar

Related Questions

I have a Silverlight 4 DataGrid which has its ItemsSource bound to an ObservableCollection
We have custom headers in the Silverlight DataGrid using the ContentTemplate. We've got a
I'm using the Silverlight 3 datagrid and have a number of custom styles applied
I am using checkbox in an itemtemplate column in a Silverlight 5 DataGrid .
I have a specialprice lookup window in my silverlight project which is bound to
I have Silverlight Sketch project, and I`m using muliticolumn listview to simulate datagrid. <Style
I have a Silverlight application that is using a DataGrid. Inside of that DataGrid
I have created a datagrid in silverlight having all textboxes(using CellEditingTemplate).. On click of
I have a Silverlight 3 tools library with a custom DataGrid user control. This
I have a DataGrid in a Silverlight application. This application is using RIA Data

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.