zoukankan      html  css  js  c++  java
  • DataGrid 删除一行数据

     设置DataGrid CanUserAddRows="True",自动添加一行。

    控制当前row为新增行时不能删除

    IEditableCollectionView editableCollectionView = dgDrug.Items;
    if (editableCollectionView.IsAddingNew)
      return;
    

      

         private void BtnDeleteDrug_Click(object sender, RoutedEventArgs e)
            {
                try
                {
                    var entity = ((Button)sender).Tag as CoPaymentSchemeItemPriceEntity;
                    if (entity == null || entity.EntityDataRow == null)
                        return;
                    IEditableCollectionView editableCollectionView = dgDrug.Items;
                    if (editableCollectionView.IsAddingNew)
                        return;
                    ViewModel.Model.CoPaymentSchemeItemDrugPriceList.Remove(entity);
                }
                catch (PresentationException pex)
                {
                    pex.Report();
                }
                catch (Exception ex)
                {
                    new PresentationException(ex).Report();
                }
            }
  • 相关阅读:
    程序猿小白博客报道
    UML
    mysql隔离级别相关
    mac使用相关笔记
    git相关
    maven相关
    springboot相关
    guava
    IDEA高效运用技巧
    spring事务相关
  • 原文地址:https://www.cnblogs.com/zqt14520/p/8624682.html
Copyright © 2011-2022 走看看