摘要: <sdk:DataGridTemplateColumn Width="80"><sdk:DataGridTemplateColumn.CellTemplate><DataTemplate><Button Content="Delete" Click="DeleteButton_Click" /></DataTemplate></sdk:DataGridTemplateColumn.CellTemplate></sdk:DataGridTemplateColu 阅读全文
posted @ 2012-06-17 18:46 Ken-Cai 阅读(148) 评论(0) 推荐(0) 编辑
摘要: Deleting the selected row(s) requires you to get the bound collection or collection view and enumeratethrough the SelectedItems property of the DataGrid, removing the corresponding item from the boundcollection/collection view. This is can be somewhat of a messy process due to removing items in anen 阅读全文
posted @ 2012-06-17 18:44 Ken-Cai 阅读(233) 评论(0) 推荐(0) 编辑
摘要: The final (and generally most user-friendly) method is to automatically maintain an empty row as thelast row in the DataGrid. The user can enter data for a new item in this row, and the DataGrid shouldautomatically add a new empty row once they do. Sadly, there is no built-in feature like this in th 阅读全文
posted @ 2012-06-17 18:42 Ken-Cai 阅读(218) 评论(0) 推荐(0) 编辑
摘要: the DomainDataSourceView class doesn’t have an Insert method, but if you have areference to the bound collection that does support this method (such as an ObservableCollection) andwant to insert a new row after the currently selected row, you can use the following codeObservableCollection<Product 阅读全文
posted @ 2012-06-17 18:32 Ken-Cai 阅读(626) 评论(0) 推荐(0) 编辑
摘要: DomainDataSourceView view = productDataGrid.ItemsSource as DomainDataSourceView;Product newProduct = new Product();view.Add(newProduct);// Scroll the first cell of the new row into view and start editingproductDataGrid.Focus();productDataGrid.SelectedItem = newProduct;productDataGrid.CurrentColumn = 阅读全文
posted @ 2012-06-17 18:29 Ken-Cai 阅读(115) 评论(0) 推荐(0) 编辑
摘要: bool hasChanges = ((Entity)ProductsDataForm.CurrentItem).HasChanges; 阅读全文
posted @ 2012-06-17 18:27 Ken-Cai 阅读(105) 评论(0) 推荐(0) 编辑
摘要: object element = FocusManager.GetFocusedElement(); 阅读全文
posted @ 2012-06-17 18:26 Ken-Cai 阅读(112) 评论(0) 推荐(0) 编辑