wpfdatagrid

DataGridColumn with Header '*' already exists in the Columns collection of a DataGrid

余生颓废 提交于 2021-02-20 05:48:28
问题 I have a WPF application with MVVM pattern. In one of my view, I have to bind an ObservableCollection to view. In that view, I have one ListBox and one DataGrid both bind to the same ObservableCollection but doing different things like events, style etc.. I need only one of these controls displayed at a time and what I did is created two user controls, one for DataGrid and other for ListBox . And I switched between them by placing a ContentControl on the main view(something similar to this

WPF DataGrid Full Row Editing

允我心安 提交于 2021-02-19 08:02:13
问题 I have a WPF datagrid which works for what I want, but there are two cells in each row which can be edited. Is it possible to place both of these rows into edit mode when the row is edited, then fire the update when the row edit ends/the row loses focus? Currently, after each cell is edit, RowEditEnding fires and the user must wait for the UI to redraw after the commit. The code I'm using is: private bool isManualEditCommit; private void dg_RowEditEnding(object sender,

DataGrid DataGridTemplateColumn ComboBox

自作多情 提交于 2021-02-17 05:51:33
问题 I'm having trouble with my ComboBoxes in a DataGrid , let me explain with a few pictures. This is the starting point. Now if I want to add a new row I click the last row and hit Enter. A new row is added and iv selected type table here and given it a name MY_TABLE, then I hit enter to add another row. The result is this, the combobox for the previous added row's type selection has gone back to None. NOTE: that the checkboxes were previously grayed out as type None cant have any privileges,

WPF DataGridCell Margin

巧了我就是萌 提交于 2021-02-10 07:49:05
问题 I have the following data grid: <DataGrid Name="PropertiesDataGrid" ItemsSource="{Binding PropertiesDataView, UpdateSourceTrigger=PropertyChanged}" SelectedItem="{Binding SelectedProperty, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" AutoGenerateColumns="False" CanUserAddRows="False" MaxHeight="200"> <i:Interaction.Behaviors> <helper:ScrollIntoViewBehavior/> </i:Interaction.Behaviors> <DataGrid.Columns> <DataGridTemplateColumn Header=""> <DataGridTemplateColumn.CellTemplate>

Validate row when underlying data changes

喜夏-厌秋 提交于 2021-02-04 08:09:04
问题 Imagine a DataGrid with its ItemsSource set to an ObservableCollection . This collection provides a view model for each row in the DataGrid . The view model in turn provides the data that is displayed in one row and a command that may change this data. Additionally, I added a rule to the RowValidationRules property of DataGrid . This validation rule works fine in case I enter invalid data. However, if I change the invalid data to valid data via the command the view model provides, the row

Validate row when underlying data changes

房东的猫 提交于 2021-02-04 08:08:27
问题 Imagine a DataGrid with its ItemsSource set to an ObservableCollection . This collection provides a view model for each row in the DataGrid . The view model in turn provides the data that is displayed in one row and a command that may change this data. Additionally, I added a rule to the RowValidationRules property of DataGrid . This validation rule works fine in case I enter invalid data. However, if I change the invalid data to valid data via the command the view model provides, the row