Questions tagged [datagrid]
A graphical user interface element to display and manipulate data in a tabular format.
datagrid
18,678
questions
226
votes
19
answers
197k
views
JavaScript data grid for millions of rows [closed]
I need to present a large number of rows of data (ie. millions of rows) to the user in a grid using JavaScript.
The user shouldn't see pages or view only finite amounts of data at a time.
Rather, it ...
223
votes
5
answers
102k
views
WPF datagrid empty row at bottom
I bind my datagrid using
//fill datagrid
public DataTable GameData
{
get
{
DataSet ds = new DataSet();
FileStream fs = new FileStream(IMDB.WebPage.Class.Config.XMLPath,
...
161
votes
12
answers
91k
views
How to perform Single click checkbox selection in WPF DataGrid?
I have a DataGrid with first column as text column and second column as CheckBox column. What I want is, if I click the check box. It should get checked.
But, it takes two click to get selected, for ...
143
votes
8
answers
179k
views
How can I set the color of a selected row in DataGrid
The default background color of a selected row in DataGrid is so dark that I can't read it. Is there anyway of overriding it?
Tried this
<dg:DataGrid.RowStyle>
<Style TargetType="{x:...
143
votes
12
answers
141k
views
How do I make XAML DataGridColumns fill the entire DataGrid?
I am using DataGrids in XAML (not Silverlight) with resizable columns, the DataGrid will expand if the user resizes the screen.
Currently if the widths of all the DataGrid columns are less than the ...
139
votes
5
answers
124k
views
How can I disable editing cells in a WPF Datagrid?
I'm constructing a datagrid in Windows Presentation Foundation, and I have a problem. When a user double-clicks on a cell in my datagrid, the cell goes into edit mode. I want to prevent that. Instead ...
128
votes
8
answers
122k
views
How do I bind a WPF DataGrid to a variable number of columns?
My WPF application generates sets of data which may have a different number of columns each time. Included in the output is a description of each column that will be used to apply formatting. A ...
122
votes
4
answers
65k
views
How Do I Hide wpf datagrid row selector
I'm using the WPF DataGrid control to show some details and a select button, and I don't need the gray selector column down the left-hand side. It's also ruining the beauty of my design.
Is there a ...
120
votes
3
answers
167k
views
Accessing UI (Main) Thread safely in WPF
I have an application which updates my datagrid each time a log file that I'm watching gets updated (Appended with new text) in the following manner:
private void DGAddRow(string name, FunctionType ...
107
votes
4
answers
133k
views
How to set DataGrid's row Background, based on a property value using data bindings
In my XAML code, I want to set the Background color of each row, based on a value of the object in one specific row. I have an ObservableCollection of z, and each of the z has a property called State. ...
104
votes
3
answers
71k
views
WPF Error: Cannot find governing FrameworkElement for target element
I've got a DataGrid with a row that has an image. This image is bound with a trigger to a certain state. When the state changes I want to change the image.
The template itself is set on the ...
104
votes
5
answers
107k
views
Button in a column, getting the row from which it came on the Click event handler
I've set the itemsource of my WPF Datagrid to a List of Objects returned from my DAL. I've also added an extra column which contains a button, the xaml is below.
<toolkit:DataGridTemplateColumn ...
98
votes
4
answers
65k
views
Binding Visibility for DataGridColumn in WPF
How can I hide a column in a WPF DataGrid through a Binding?
This is what I did:
<DataGridTextColumn Header="Column header"
Binding="{Binding ColumnValue}"
...
96
votes
4
answers
94k
views
WPF StringFormat on Label Content
I want to format my string binding as Amount is X where X is a property bound to a label.
I've seen many examples but the following doesn't work:
<Label Content="{Binding Path=...
93
votes
8
answers
143k
views
Binding ItemsSource of a ComboBoxColumn in WPF DataGrid
I have two simple Model classes and a ViewModel...
public class GridItem
{
public string Name { get; set; }
public int CompanyID { get; set; }
}
public class CompanyItem
{
public int ID {...
88
votes
13
answers
66k
views
OpenClipboard failed when copy pasting data from WPF DataGrid
I've got a WPF application using datagrid. The application worked fine until I installed Visual Studio 2012 and Blend+SketchFlow preview. Now, when I'm trying to copy the data from the grid ...
84
votes
8
answers
281k
views
programmatically add column & rows to WPF Datagrid
I want to know how should we add columns and rows programmatically to a DataGrid in WPF. The way we used to do it in windows forms. create table columns and rows, and bind it to DataGrid.
I have No. ...
83
votes
12
answers
49k
views
DataGrid's selected row color when inactive
How can I style WPF DataGrid to change the color of selected row when DataGrid lost its focus?
78
votes
9
answers
197k
views
Change DataGrid cell colour based on values
I have got a WPF datagrid and I want diffrent cell colours according to values. I have got below code on my xaml
Style TargetType="DataGridCell"
but instead of selecting a cell only is selecting all ...
78
votes
2
answers
59k
views
How do I Add a Tooltip To a DataGridTextColumn
I'm using WPFtoolkit DataGrid ,I have to wrap text in a DataGridTextColumn or
I have to add a ToolTip to the text column. I have searched the net but i couldn't get a proper solution. Expecting ...
77
votes
14
answers
275k
views
Get selected row item in DataGrid WPF
I have a DataGrid, bound to Database table, I need to get the content of selected row in DataGrid, for example, I want to show in MessageBox content of selected row.
Example of DataGrid:
So, if I ...
77
votes
5
answers
62k
views
Set a padding on dataGridCells in WPF
simple question: How can I set a padding on a dataGridCell in WPF?
(either one at a time or on all cells, I don't care)
I have tried using the DataGrid.CellStyle property by adding a setter on the ...
76
votes
7
answers
133k
views
Date formatting in WPF datagrid
I want to change is the date column from a format "DD/MM/YYYY HH:MM:SS" to "DD.MM.YYYY".
<DataGrid Name="dgBuchung" AutoGenerateColumns="True"
...
76
votes
7
answers
137k
views
how can I enable scrollbars on the WPF Datagrid?
When I run the following Northwind WPF Toolkit Datagrid code from this article, I get a datagrid, but there are no scrollbars and hence the user can only see part of the datagrid. I am using the ...
70
votes
7
answers
77k
views
How get a WPF Datagrid with cells that wrap text instead of truncating it?
What must be done to get a WPF DataGrid with cells that wrap text instead of truncating it?
Right now when a text is bigger and don't fit in a column the text is truncated and users can't see it ...
68
votes
9
answers
70k
views
Select multiple items from a DataGrid in an MVVM WPF project
How can I select multiple items from a DataGrid in an MVVM WPF project?
68
votes
4
answers
146k
views
Adding a Button to a WPF DataGrid
I want to create a DataGrid control in WPF in which there is a button in the first cell of each row. Clicking this button will show RowDetailsTemplate or the SubRow.
How do I add a button which will ...
67
votes
2
answers
53k
views
Removing all DataGrid row and cell borders
I want to hide (or remove) all the borders of all the rows (and subsequently cells) in my datagrid, think a basic HTML table. I've looked all over and most questions seem to be about styling them and ...
67
votes
7
answers
48k
views
Disable DataGrid current cell border in FullRow selection mode
I am using a DataGrid in row selection mode (i.e., SelectionUnit="FullRow"). I simply want to remove the border that is being placed around the current cell when the user highlights a row in order to ...
67
votes
5
answers
72k
views
How to get a WPF DataGrid cell to right align without making the selectable area on a new row tiny?
I'm using a WPF4.0 DataGrid. When double clicking on a cell in a new row everything works fine unless I've added a cell style to that column. For example, I have a numeric column where I want the data ...
65
votes
10
answers
98k
views
DataGrid row content vertical alignment
I have a regular DataGrid from WPF 4.0 RTM, where I put data from a database. In order to make clean & light style of DataGrid I use a tall/high rows and by default DataGrid aligns row content in ...
65
votes
3
answers
60k
views
how to make material data grid width to fill the parent component in react js
I'm trying to display the data grid with all columns should take equal width to fit the parent component. but there is a blank space at the end which I'm not able to remove and cannot make columns to ...
64
votes
9
answers
111k
views
Text alignment in DataGrid
I'm programming by WPF. I need a way to make center content of cells, in DataGrid control. I use this code also:
<DataGrid x:Name="dg1" HorizontalAlignment="Left" Margin="10,10,0,0"
...
64
votes
1
answer
66k
views
How to add context menu to wpf datagrid?
How does one add a ContextMenu to a DataGrid? I want to be able to right click anywhere on the DataGrid.
61
votes
3
answers
50k
views
WPF DataGrid: Make cells readonly
I use the following DataGrid
<DataGrid Grid.Row="1" Grid.Column="1" Name="Grid" ItemsSource="{Binding}" AutoGenerateColumns="False" >
<DataGrid.Columns>
<...
59
votes
13
answers
111k
views
Disable selecting in WPF DataGrid
How can I disable selecting in a WPFTooklit's DataGrid?
I tried modifying the solution that works for ListView (from WPF ListView turn off selection), but that doesn't work:
<tk:DataGrid>
&...
58
votes
2
answers
62k
views
Difference between ListView and DataGrid in WPF?
I have to retrieve some questions from the database and display them on the user screen dynamically. I also need to add some controls in the columns of grid view, basically a question and input box ...
56
votes
5
answers
56k
views
wpf datagrid alternate row coloring
I have tried this method.. without luck..
<Style TargetType="{x:Type DataGridRow}">
<Style.Triggers>
<Trigger Property="ItemsControl.AlternationIndex" Value="0">
...
54
votes
3
answers
46k
views
Coloring Gridlines in WPF Datagrid
How can I set the color of the gridlines of a wpf datagrid? I can hide these lines with the property GridLinesVisibility, but I don't know how to color them. I tried it with the Borderbrush of rows ...
51
votes
4
answers
145k
views
How do I bind a List<CustomObject> to a WPF DataGrid?
I'm new to WPF and want to do some basic databinding.
I have a List of a CustomObject and want to bind it to a DataGrid.
MainWindow.xaml.cs
using System;
using System.Collections.Generic;
...
49
votes
2
answers
26k
views
WPF XAML : How to disable multi selection in a DataGrid?
In a DataGrid like this :
<DataGrid AutoGenerateColumns="False" Height="200" Name="dataGrid"
IsReadOnly="True" ItemsSource="{Binding CollectionView}" >
...
</Datagrid>
How do you ...
48
votes
7
answers
61k
views
wpf: DataGrid disable selected row styles - or row selecting
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 ...
48
votes
12
answers
37k
views
Mouse scroll not working in a scroll viewer with a wpf datagrid and additional UI elements
I am trying to figure out how to get the mouse scroll working on a wpf window with a scrollviewer and a datagrid within it. The WPF and C# code is below
<ScrollViewer HorizontalScrollBarVisibility=...
47
votes
11
answers
53k
views
WPF DataGrid is very slow to render
I have tried using both a customized DataGrid as well as the stock one in WPF. I have tried populating them manually as well as through bindings. In both cases they are slow.
I have a scenerio ...
47
votes
7
answers
116k
views
WPF datagrid selected row clicked event ?
I want to execute some code when a a selected row of the WPF DataGrid is double clicked. I know that the datagrid has a MouseDoubleClicked event and that it also has a row selected event but I don't ...
47
votes
2
answers
71k
views
ListView.GridViewColumn (*) width
I am using ListView control instead of DataGrid in my WPF application. I want to give * width to my ListView.GridViewColumn, but whenever I am providing * width to ListView.GridViewColumn, it gives me ...
47
votes
1
answer
62k
views
How can I paginate a WPF DataGrid?
How can I set paging in a wpf DataGrid?
46
votes
3
answers
95k
views
WPF DataGrid selected row style
I'm stuck with one very stupid problem - need to style selected row in WPF DataGrid.
I want to show a rectangle with blue border instead of just filling entire row with some color.
Any ideas how ...