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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T13:22:13+00:00 2026-06-09T13:22:13+00:00

I have datagrid with a delete button XAML looks like: <sdk:DataGridTemplateColumn Header=Del/Tgl > <sdk:DataGridTemplateColumn.CellTemplate>

  • 0

I have datagrid with a delete button XAML looks like:

<sdk:DataGridTemplateColumn Header="Del/Tgl" >
    <sdk:DataGridTemplateColumn.CellTemplate>
        <DataTemplate>
            <Button Content="Delete" 
           Command="{Binding DeleteRowCommand}"
                    CommandParameter="{Binding Column}"
                    />
        </DataTemplate>
    </sdk:DataGridTemplateColumn.CellTemplate>
</sdk:DataGridTemplateColumn>

I implemented ICommand as DelegateCommand by copying the code from John Papa. I added a public property to my ViewModel :

public ICommand DeleteRowCommand {get;set;}

In the constructor of my viewModel I set the command:

this.DeleteRowCommand = new DelegateCommand(onDelete, CanDelete);

and finally defined the onDelete, and CanDelete:

private void onDelete(object param)
{
    // Get the Column Name
    string strColumnName = param as string ?? string.Empty;
}

private bool CanDelete(object param)
{
    // If we ae here we can delete the row
    return true;
}

Everything works on my Silvelight grid but the delete button click, and I never go to onDelete function. What am I doing wrong?

  • 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-09T13:22:15+00:00Added an answer on June 9, 2026 at 1:22 pm

    Basically Command binding will look for DeleteRowCommand property inside the Object ( I mean the list of object that is binded as ItemSource to the datagrid). So you need to set the Source of Binding or use relativesource if you are using SL5.

    Cheers!
    Vinod

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

Sidebar

Related Questions

I have a datagrid like this: <dg:DataGrid Name=dg AutoGenerateColumns=False CanUserDeleteRows=True> <dg:DataGrid.Columns> <dg:DataGridTextColumn Header=Product Code
i have a datagrid declared in the xaml as follows: <sdk:DataGrid x:Name=ProductsForProjectDataGrid AutoGenerateColumns=True ItemsSource={Binding
I am trying to add a delete button to the Dojo Datagrid and I
I have a datagrid from which I'd like be able to remove rows at
I am using .net4.0. I have a DataGrid with 5 cols. I added DataGridTemplateColumn
I have datagrid in wpf. When I do mouse-over on column header, There is
I have a datagrid buttoncolumn which acts as delete buttons for my xml nodes.
I have a datagrid where ten rows will be populated with edit and delete
I have added button to datagrid view but when ever the function is called
EXACT duplicate of Datagrid View Button repeat I have added button to datagrid view

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.