Guest User

Untitled

a guest
Jan 16th, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. 1 `Disconnected Mode`
  2.  
  3. //GetChanges return added rows before update datasource from caching
  4. var newRows = YourDataTable.GetChanges(DataRowState.Added);
  5.  
  6. DataColumn columnFlag = new DataColumn("FlagDelete", typeof(bool));
  7.  
  8. 2 `Connected Mode`
  9.  
  10. <DataGridTemplateColumn>
  11. <DataGridTemplateColumn.CellTemplate>
  12. <DataTemplate>
  13. <Button Content="Remove" Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type TabControl}}, Path=DataContext.BottomDetailVM.DeleteCommand}" Visibility="{Binding IsNew, Converter={StaticResource Bool2VisibilityConverter}, FallbackValue=Collapsed}" CommandParameter="{Binding}" />
  14. </DataTemplate>
  15. </DataGridTemplateColumn.CellTemplate>
  16. </DataGridTemplateColumn>
  17.  
  18. public ICommand DeleteRangfolgeCommand
  19. {
  20. get
  21. {
  22. return new ActionCommand<MyOwnViewModel>(ExecuteDelete);
  23. }
  24. }
  25.  
  26. private void ExecuteDelete(MyOwnViewModel viewModelToDelete)
  27. {
  28. this.ItemsSourceList.Remove(viewModelToDelete);
  29. }
Add Comment
Please, Sign In to add comment