datagrid

WPF DataGrid customization: alignment, scrolling, performance, usability

I develop desktop-based WPF-application, that uses SQL Server 2008 R2 Database and ADO.NET Entity Framework as connection tool between database and application. In one of the windows there is need to show content of database's table and let user to perform some manipulations, such as add new record to database, edit selected record and ...

How to use the DataGrid control with SQLiteDataReader?

I am developing mobile application in C#. I want to read the values from the database & display in the gridview control. I am not aware of of how to use the SQLiteDataReader with datagrid control in compact framework. My code is running properly but I am not able to display the values in the datagrid SQLiteDataReader SQLiteDrKeyObj = nu...

WPF4 Datagrid doesn't sort on column headers

I am trying to implement my first WPF application using an MVVM design pattern. I created an application that is databinding to an ObservableCollection<>. The application renders fine, but I expect the datagrid to re-sort the rows when I click on the column headers. I've researched posts that said: The data source has to implement IEn...

How to refresh a specific row in WPF DataGrid?

I know there is Row.Items.Refresh() which I assume will refresh the whole DataGrid. Is there a method to refresh a specific row only? ...

How to autoresize the DataGrid Control & DataTable in .net compact framework ?

I am developing mobile application in C#. I am using SQLite as a database. I am using the following code SQLiteDataReader SQLiteDrKeyObj = null; DataTable dt = new DataTable(); DataManager DataMgrObj = new DataManager(); QueryDetails QueryDetailsObj = new QueryDetails(); //int ...

Silverlight DataGrid - Dirty Rows

I have a Silverlight DataGrid, for which the user can change values in. I also have a "Save" button. When the user clicks the "Save" button, I want only the rows (items) from the data grid that the user has changed to be saved. How can I accomplish this? ...

DataTable Filtering

Hi, I have a method that gets a list of numbers and filters my datatable according to it. I use this code: string MyQuery = CreateQueryMethod(MyNumbersList); MyDataTable.DefaultView.RowFilter = MyQuery; But if I get an empty list, MyQuery is just: "" // (string.empty) and if RowFilter is an empty string it shows the entire datatabl...

How do you change the .Net CF 3.5 DataGrid scrollbar colors?

I'm writing a .Net Compact Framework 3.5 app that uses the DataGrid control. I'm trying to figure out how to set the vertical and horizontal scrollbar colors (background and foreground). Solutions? Thanks. ...

Filter a collection with LINQ vs CollectionView

Hello, I want to filter a ObservableCollection with max 3000 items in a DataGrid with 6 columns. The user should be able to filter in an "&&"-way all 6 columns. Should I use LINQ or a CollectionView for it? LINQ seemed faster trying some www samples. Do you have any pro/cons? UPDATE: private ObservableCollection<Material> _materialLi...

How do you restrict selection of cells to exclude a column in a DataGrid?

I have a datagrid based selection control that duplicates the Easing Function selector in Expression Blend. This is for the Easing Function project so you will also be helping yourself :) This selector is a permanent fixture on the screen, to make it easy to try out options, while still looking enough like the options you normally sele...

How to find its owner DataGrid and DataGridRow from DataGridCell in WPF?

In an event handler for a Command for a DataGrid, I get DataGridCell in ExecutedRoutedEventArgs. However, I couldn't figure out how to get its associated DataGrid and DataGridRow. Your help is much appreciated. ...

How to retrieve the Cell or Row value for Silverlight DataGrid, when using ValidationSummary

I'm adding items to a DataGrid's validation summary manually. This is all working, but I can't find a way to retrieve the cell which contains the error. I need a reference to the cell because I need to focus that cell when the user clicks on the error. I know what the bound data item, and the property causing the error, but it doesn't ...

Validating new rows in Silverlight DataGrid

We're using RIA Services / Silverlight 4, and I'm binding a datagrid to something like Context.Foo. I can see validation errors appearing in the datagrid's validation summary when users try to enter empty strings into mandatory fields and so forth, life is good. However when I add a new item by calling something like Context.Foo.Add(ne...

Dojo DataGrid - preventing column resize

Hello, Is there a way to set a fixed column size in Dojo DataGrid, and not allow it to be resized by the user? Thanks. ...

Fix DataGrid Column Headings When Scroll Viewer is Applied

I have a DataGrid wrapped in a ScrollViewer like this... <ScrollViewer MaxHeight="600" VerticalScrollBarVisibility="Auto" BorderThickness="0" Padding="0"> <sdk:DataGrid ItemsSource="{Binding BatchItems}" IsReadOnly="True"> <sdk:DataGrid.Columns> <!-- Yada, yada, yada --> </sdk:DataGrid.Colum...

Set selected WPF DataGridCell to focused and editable upon event

Woot, first Stack Overflow post! I've been asked to work on a desktop application to improve an inventory process for my company. I dabbled with WPF in school and I figured I'd start there. After researching some, I learned about MVVM, put a design together, and forged ahead. Finally, I'm stuck and looking for some help and also a sanity...

WPF Datagrid Template column edit event and alternating column color

I have been using WPF for quiet sometime. I know DataGrid in WPF does not have a Column collection as dependency property so columns cannot be added dynamically. The application I am developing is highly dynamic so the number of columns are not known. So I am creating DataGridTemplate columns from code behind. Problem 1 : I want alter...

Print WPF Visuals with MVVM pattern

My ViewModel has a PrintCommand executing a Method called PrintCalendar(). But the Calendar aka datagrid is in the View, so how do I get my datagrid into the ViewModel? Getting my hands dirty and do all that stuff in code-behind? oh no... PrintDialog printDlg = new PrintDialog(); printDlg.PrintVisual(datagrid, "Grid Printing."); ...

WPF DataGrid: CommandBinding to a double click instead of using Events

I know how to use the MouseDoubleClick event with my DataGrid to grab the selectedvalue, but how would one go about using command bindings instead? That way my ViewModel can handle the logic. So far I have the following: <DataGrid Name="TestGrid" Grid.Row="2" Grid.ColumnSpan="2" AutoGenerateColumns="True" MouseDoubleClick="TestGrid_Mou...

WPF DataGrid: How to clear selection programmatically?

It is a simple task in another grid, but I can't make it happen in WPF DataGrid. There are UnselectAll or UnselectAllCells methods, but don't work. Also, setting SelectedItem = null or SelectedIndex = -1 don't work either. There is a post here about completely disable selection, but that's not what I want. I just want to clear the curre...