Silverlight DataGrid Add Delete column/delete button

Source: Internet
Author: User
Tags silverlight

<sdk:datagrid x:name="DataGrid1"Horizontalalignment="Center"Verticalalignment="Top"margin="0,41,0,0"autogeneratecolumns="False"isreadonly="True"> <sdk:DataGrid.Columns> <sdk:datagridtextcolumn header="ID"binding="{Binding ID}"/> <sdk:datagridtextcolumn header="User name"binding="{Binding UserName}"/> <sdk:datagridtextcolumn header="birtherdate"binding="{Binding birtherdate,stringformat=yyyy-mm-dd HH:mm:ss}"/> <sdk:datagridtextcolumn header="Height"binding="{Binding Height}"/> <sdk:datagridtextcolumn header="Sex"binding="{Binding Sex}"/> <sdk:datagridtemplatecolumn width=" -"Header="Delete"> <sdk:DataGridTemplateColumn.CellTemplate> <DataTemplate> <button content="Delete"click="Button_click_del"Width=" -"/> </DataTemplate> </sdk:DataGridTemplateColumn.CellTemplate> </sdk:DataGridTemplateColumn> </sdk:DataGrid.Columns> &L T;/sdk:datagrid>
1 Private voidButton_click_del (Objectsender, RoutedEventArgs e)2         {3Button B = Sender asButton;4Person P = (person) B.datacontext;//Get Current Data5             if(p!=NULL)6             {7Client. Deleteasync (P);//Delete8             }9}

Silverlight DataGrid Add Delete column/delete button

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.