wpfdatagrid

WPF DataGrid selecting disabled

In VS 2010/.NET 4.0, I have a List<MyClass> list of a simple class as such: public class MyClass { public string String1 { get; set; } public string String2 { get; set; } public MyClass(string string1, string string2) { String1 = string1; String2 = string2; } } This list is displayed in a W...

WPF Toolkit Datagrid Headers and Empty Source...

Hi, How could I make the Datagrid display the headers in case there's no row to display? My Datagrid is "completely" read-only with: "AutoGenerateColumns ="True" "CanUserAddRows="False" "CanUserDeleteRows="False" "CanUserResizeRows="False" "IsReadOnly"="True" If there's no row, then the headers aren't displayed, if I add even an empt...

Retrieve Column data from datagrid, Coded UI tests

Hello, I am trying to retrieve data from a datagrid. I am using it for automated gui testing in Visual Studio 2010 with C#. When I search a datagrid I have to enter dummy values because when there is one row, the second column displays blank when it is not. The datagrid is third party code and is not standard Microsoft datagrids. I am n...

Wpf 4 DataGrid Column Binding Problem

I have created a datagrid with columns bound to an observable collection. All works well except for a column which is bound to a nullable decimal property from my business object. If I use <DataGridTextColumn Binding="{Binding Path=BaseUnitCostValue}" Header="Unit Cost Value" MinWidth="100" /> as my column definition all works well,...

Accessing the WPF DataGrid "empty" or "rowcolumn" header

I am trying to access the header that is at the intersection of the rows and columns headers in a Net3.5 WPF DataGrid. Josh Smith calls this the "Empty Header" in an article on a different grid control and I would call it the "RowColumn" header since it in the first position for both the column and row headers and is the only header tha...

DataGrid in a StackPanel leads to OutOfMemoryException

I have grid in a WPF window and a DataGrid control inside: <Grid> <DataGrid ItemsSource="{Binding AllAuthors}" /> </Grid> AllAuthors is an ObservableCollection<Author> and Author a simple class with only a few string properties. The collection is populated with around 40000 objects in code behind. The DataGrid opens quite quickly ...

Row Number In datagrid Control WPF

How can I display row number in the first cell of the datagrid control, I don't have the row number or any other information, just data from the data base and Some Value Some Other value and I want the output like First Some Value Secont Some Other Value How can I do that, any idea ...

Convert the Following Lines

How can i convert the following lines so that i can get the selected data from a combo box in a WPF Datagrid. The combo box is bound to a Linq to SQL table. object obj = ((DataRowView)editingElement.DataContext).Row [this.SelectedValuePath]; and (DataRowView)editingElement.DataC...

WPF Datagrid SelectionChanged event is triggering Multiple times while loading the rows.

Hi, When i use DataGridComboBoxColumn in my WPF DataGrid, the DataGrid SelectionChanged event is triggering multiple times based on the number of rows while loading the rows in the WPF DataGrid. How can i stop this? Because of this I am facing Performance issue. ...

MVVM and DataGrid View re-use as embedded controls within otherviews with subset data.

Okay here's the situation. Net 4 WPF NO Silverlight. I have several Views that present a datagrid showing the contents of some observable collections e.g. ObservableCollection<ClassAViewModel> sourceA; ObservableCollection<ClassBViewModel> sourceB; ObservableCollection<ClassCViewModel> sourceC; The collections are populated by a call...

PagedCollectionView groupings don't seem to automatically be refreshed when a new element is added to the source collection.

Hello, I'm using a PagedCollectionView to bind an ObservableCollection<T> to a DataGrid in my Silverlight app. In this case, the source collection can incur an unbounded number of updates during its lifespan. It seems, however, that if I'm using a PropertyGroupDescription to group the elements in the DataGrid then I need to reapply that...

WPF - Creating a dynamic datagrid in xaml by datatemplate

I am trying to create a DataGrid by datatemplates. The reason is I want the columns to be dynamically created but all in xaml and not in code behind. I get a List based on which I want to create my grid columns in xaml. class GridColumnElement { public string HeaderCaption { get; set; } public string PropertyName { ...

How to remove auto generated right blank column from the wpf datagrid?

<DataGrid ItemsSource="{Binding Contracts}" Name="dataGrid" AutoGenerateColumns="False"> <DataGrid.Columns> <DataGridTextColumn Header="Number" Binding="{Binding Number}"> </DataGridTextColumn> <DataGridTextColumn Header="PaymentTerms" Binding="{Binding PaymentTerms}"> </DataGrid...

WPF Data Grid - How to hide the next column/row that is visible?

I'm using a WPF data grid to bind to an object (i.e. not a database). I have the horizontal alignment on Stretch. I currently have it within a Border, which is within a Grid. However when I run the application the DataGrid has a blank column and grid showing. That is say I have 5 columns & 5 rows, then there is a blank 6th column and...

WPF: Copy from a DataGrid

I would like to add Copy functionality to a WPF DataGrid. The Copy option should appear in a right-click menu It should copy the display text for the selected cell. (I am using read-only text columns.) ...

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 first click the cell is getting selected, for the second clicks the check box is getting checked. How to make the check box to get checked/u...

WPF DataGrid: Is there a way to begin editing a row when a different row has a validation error?

By default a validation error in one row will prevent you from editing other rows. Is there a way to change this so other rows can still be edited? ...

WPF DataGrid: Can I cancel a change selection action?

Currently I'm catching the SelectionChanged event, but I would prefer to catch an eariler event that will allow me to cancel the selection change. Background: I have two data grids, the lower being a detail of the upper. When the upper changes, I currently prompt the user to save changes. But if there are validation errors, I want to o...

WPF DataGrid: How do I change the selected row programatically?

How do I change the selected row programatically? I change change the selected item and cell, but I cannot figure out how to get the whole row highlighted. Note: The highlighting works fine when a user selects a row with mouse or keyboard. ...

WPF DataGrid: Disallow multiple row highlighting

How can I make the data grid not allow the user to select multiple rows? ...