wpfdatagrid

Event for Select All: WPF Datagrid

前提是你 提交于 2019-11-27 18:14:19
问题 I am using WPF data-grid. In data-grid user have column-headers and row-headers. When column-headers and row-headers both of them are visible, in the top left corner we have one small square section available. (cross section in the top left corner where the column and row headers meet.) when we click on that it selects all the cells within data-grid. Is there any event for that? If not how can trap that event. Please guide me. Do let me know if you need any other information regarding this

WPF DataGrid: Blank Row Missing

北城余情 提交于 2019-11-27 16:06:44
I am creating a WPF window with a DataGrid , and I want to show the blank "new item" row at the bottom of the grid that allows me to add a new item to the grid. For some reason, the blank row is not shown on the grid on my window. Here is the markup I used to create the DataGrid : <toolkit:DataGrid x:Name="ProjectTasksDataGrid" DockPanel.Dock="Top" Style="{DynamicResource {x:Static res:SharedResources.FsBlueGridKey}}" AutoGenerateColumns="False" ItemsSource="{Binding SelectedProject.Tasks}" RowHeaderWidth="0" MouseMove="OnStartDrag" DragEnter="OnCheckDropTarget" DragOver="OnCheckDropTarget"

How to bind an 2D array bool[][] to a WPF DataGrid (one-way)?

百般思念 提交于 2019-11-27 15:08:26
问题 I have a matrix kind datagrid like this. this grid is designed entirely in XAML Now how to insert values into these datagridcell with 2 dimensional array ? the values which is needed to be inserted must be of bool datatype (either TRUE or FALSE). Any ideas ? 回答1: Here is my approach for a MVVM scenario, using a converter which creates a DataView which can be bound to the grids ItemsSource . It's for a special Matrix datatype which holds doubles, but you'll be able to modify it yourself for

How to make the last DataGrid's column occupy the whole left space?

匆匆过客 提交于 2019-11-27 14:43:58
问题 First! I know it can seem a kind of dup nevertheless it isn't. I have a grid as a data template for DataGrid.RowDetails . It has three columns: two with Width="Auto" and the 3d with Width="*" <DataTemplate x:Key="NotEmptyDistributionsTemplateKey"> <DataGrid ItemsSource="{Binding SoftwareVersionDistributions}" CanUserAddRows="False" CanUserDeleteRows="False" CanUserReorderColumns="False" CanUserResizeColumns="True" CanUserSortColumns="False" IsReadOnly="True" CanUserResizeRows="False"

Move Focus to Next Cell on Enter Key Press in WPF DataGrid?

此生再无相见时 提交于 2019-11-27 14:43:28
问题 I want to have a Custom DataGrid which can, Move to next cell when Enter key is pressed also if it is in edit mode. When the last column in the current row is reach, the focus should move to the first cell of next row. On reaching to next cell, if the cell is editable, it should automatically became editable. If the cell contains an ComboBox not comboboxcolumn, the combobox should DropDownOpen. Please help me in this. I have been trying from the past few day by creating a Custom DataGrid and

WPF ScrollViewer around DataGrid affects column width

爷,独闯天下 提交于 2019-11-27 14:24:19
I have a problem with a ScrollViewer that I use to scroll a user control that contains a data grid. Without the scroll viewer the columns fill the data grid as I want but when adding a scroll viewer the columns shrink to ~15px. I was able to simplify my layout and can still reproduce this behaviour. When binding the datagrid width to another control the columns have their normal with, but that has unsuprisingly the same effect as a fixed width on the datagrid. I guess I'm not the first one who has this problem. How can I work around this behaviour to have my grid adjusting its size to the

wpf: DataGrid disable selected row styles - or row selecting

*爱你&永不变心* 提交于 2019-11-27 14:16:20
I am seeing a lot of examples on how to style Selected rows in DataGrid such as this one: How can I set the color of a selected row in DataGrid Can i just disabled selected row styling? i don't want to have to override every single thing that selected row changes. Just don't want any visible changes. Gotta be easier way than to create templates.. or.. disable selecting rows, if that is easier.. but from browsing this forum that seems hacky as well Disable selecting in WPF DataGrid figured out the XAML to get rid of selection style.. not ideal, but close enough.. <Style x:Key="CellStyle"

Simple way to display row numbers on WPF DataGrid

瘦欲@ 提交于 2019-11-27 13:09:44
I just want to display row numbers in the left-most column of my DataGrid . Is there some attribute to do this? Keep in mind, this isn't a primary key for my table. I don't want these row numbers to move with their rows when a column is sorted. I basically want a running count. It doesn't even need to have a header. Fredrik Hedblad One way is to add them in the LoadingRow event for the DataGrid <DataGrid Name="DataGrid" LoadingRow="DataGrid_LoadingRow" ... void DataGrid_LoadingRow(object sender, DataGridRowEventArgs e) { e.Row.Header = (e.Row.GetIndex()).ToString(); } When items are added or

WPF DataGrid validation errors not clearing

扶醉桌前 提交于 2019-11-27 12:37:17
So I have a WPF DataGrid , which is bound to an ObservableCollection . The collection has validation on its members, through IDataErrorInfo . If I edit a cell in a way so as to be invalid, and then tab away from it before hitting enter, then come back and make it valid, the cell will stop showing invalid, however, the "!" at the head of the row will still be there, and the ToolTip will reference the previous, invalid value. Not using Mode=TwoWay for DataGridTextColumns solves one version of the problem, however it seems that this problem can appear out of nowhere for other reasons as well.

Filter a DataGrid on a Text box

妖精的绣舞 提交于 2019-11-27 12:23:38
I search an example or sample to filter the WPF DataGrid column elements by a textbox. Something similar to this (the given example uses a WPFToolkit ... apparently abandoned by Microsoft...) XAML <Canvas> <DataGrid Height="200" Name="dataGrid1" Width="200" Canvas.Top="23" /> <TextBox Name="textBox1" Width="120" /> </Canvas> cs: public partial class MainWindow : Window { private List<Personne> persons; ICollectionView cvPersonnes; public MainWindow() { InitializeComponent(); persons = new List<Personne>(); persons.Add(new Personne() { Id = 1, Nom = "Jean-Michel", Prenom = "BADANHAR" });