wpfdatagrid

Caliburn.Micro and DataGrid: Reliable approach for detecting individual cell changes?

老子叫甜甜 提交于 2019-12-25 05:25:25
问题 I have an MVVM-based WPF application that relies on Caliburn.Micro . In one view, I am displaying a DataGrid and a Button . The DataGrid displays a collection of items, where the item class derives from PropertyChangedBase . The button should be enabled or disabled based on the contents in the editable DataGrid cells. What is the most reliable approach to achieve this with Caliburn.Micro ? Schematically, this is what my code looks right now: public class ItemViewModel : PropertyChangedBase {

RowDetailsTemplate ItemSource Binded to an EF NavigationProperty

只谈情不闲聊 提交于 2019-12-25 04:49:07
问题 I have a DataGrid of Person objects with another DataGrid in its RowDetailsTemplate which contains the selected person's Jobs, I am using EntityFramework to generate the DataContext , each person has a least one job (so Person contains a foreign key to another object of type PersonWork ). In order to populate the RowDetails DataGrid with the selectedPerson's works, I've bind its (the RowDetailsTemplate) itemSource to the navigation property of the Person class (generated by EF), but the

Cascading Combobox in DataGrid using DataTemplate Cross-Cell Binding

梦想的初衷 提交于 2019-12-25 04:47:09
问题 If I place my cascading comboboxes inside the same DataTemplate in a WPF DataGrid cell - the binding works properly ( via ElementName ). However, from a UI perspective I want my comboboxes to physically reside in different cells, not the same datagrid cell. How do you make cross-cell binding work ( between DataTemplates ) using DataGridTemplateColumns ? It seems the issue is that the second comboboxes' ItemsSource cannot find the ElementName for binding when the comboboxes exist in different

Using INotifyPropertyChanged to refresh a databound datagrid?

我们两清 提交于 2019-12-25 02:24:09
问题 I have created a databound datagrid in WPF: 'ActionResults', when I run the application it shows the contents of the database table. The I.T dept. are going to manually update the 'ActionResult' table in SQL server management studio. If any changes are made to the table, they will display in the datagrid only after I restart the application. I would like to add an 'Update' button which will re-fresh the datagrid, displaying any changes made to the table. I was previously trying to do a hack

How to correctly bind an object to a WPF DataGrid?

穿精又带淫゛_ 提交于 2019-12-25 01:46:35
问题 I'm trying to get a WPF DataGrid to work from a user control I'm building. Things seems to work fine. But I noticed this message in the Output window in the IDE: System.Windows.Data Error: 39 : BindingExpression path error: 'Name' property not found on 'object' ''Object' (HashCode=18165668)'. BindingExpression:Path=Name; DataItem='Object' (HashCode=18165668); target element is 'TextBlock' (Name=''); target property is 'Text' (type 'String') System.Windows.Data Error: 39 : BindingExpression

Wrapped ObservableCollection<T> throwing `'EditItem' is not allowed for this view` when bound to a WPF DataGrid

三世轮回 提交于 2019-12-24 17:26:46
问题 I created a wrapper to extend an ObservableCollection<T> [Serializable] public abstract class ModelCollection<TModel> : ModelCollectionBase, IList<TModel>, INotifyCollectionChanged, INotifyPropertyChanged where TModel : ModelBase<TModel> { private ObservableCollection<TModel> wrappedCollection = new ObservableCollection<TModel>(); // wrapper implementation goes here } I thought it was working fine until I attempted to bind items from a list to a DataGrid. <DataGrid ItemsSource="{Binding

in WPF, DataGridTextColumn's value is not rolled back after calling datagrid.CancelEdit()

亡梦爱人 提交于 2019-12-24 17:07:09
问题 I have a Data Grid containing two text columns. A user is allowed to modify the default value(which is 1). on Button click i am showing a confirmation message if user press yes ,data grid text column's value should be saved with new values and in case of No , Grid text column's value should be rolled/reset back to default or previous value. The issue lies,when a user clicks on No button from confirmation message, Data grid text column values are not rolled back or resetting to default .

Is it possible to hide columns in WPF DataGrid when defined and bound with CollectionView?

╄→尐↘猪︶ㄣ 提交于 2019-12-24 15:53:55
问题 I'm trying with example from here http://msdn.microsoft.com/en-us/library/ff407126 I would like to add a control that user can define which columns are visible. Can this be done easily? I found http://www.thomaslevesque.com/2011/03/21/wpf-how-to-bind-to-data-when-the-datacontext-is-not-inherited/ but it's different since it's not using CollectionView and CollectionViewSource. Thanks & BR -Matti 回答1: It can be done many ways. One way is to edit the Style for DataGrid's column headers. An

How to create Custom Property for WPF DataGridTextColumn

六月ゝ 毕业季﹏ 提交于 2019-12-24 15:13:18
问题 I want to add custom property in WPF DataGridTextColumn, How i can add custom property, and Bind it from C# code and retrieve it by C# code. 回答1: I just got answer for it First Create public static class dataGridTag { public static readonly DependencyProperty TagProperty = DependencyProperty.RegisterAttached( "Tag", typeof(object), typeof(dataGridTag), new FrameworkPropertyMetadata(null)); public static object GetTag(DependencyObject dependencyObject) { return dependencyObject.GetValue

How to display nested datagrids in wpf?

点点圈 提交于 2019-12-24 14:22:54
问题 I have requirement on Nested datagrid in WPF. Parent Grid Shown Order information of Consumers.When User click the details in order information, need to be displayed ordered items details in child datagrid(Means Nested grid) within the parent row of order information. I need to populate the multiple nested datagrids For first row on click Edit Button I am getting related child grid. Second row on wards the output i am getting is a empty datagrid. If I debug data is binding using ItemSource