wpfdatagrid

How to set an event for all cells in WPF Datagrid

I need OnDragEnter event for every cell on my WPF Datagrid. I tried this : <ControlTemplate TargetType="{x:Type my:DataGridCell}" x:Key="RowTemplate"> <ContentPresenter DragEnter="ContentPresenter_DragEnter" > </ContentPresenter> </ControlTemplate> But doesn't seem to work. Any ideas people? Edit: Thanks for the responses...

Why is WPFToolkit DataGrid so slow when binding?

I have a very simple test application where I have two objects, each with a small collection of items. when I select an object I display its collection in a WPFToolkit DataGrid. The problem is there is a noticeable delay, such that if you press up/down keys to toggle selection between objects you can see it can't keep up. Why is the pe...

WPF - DataGrid Column Header Alignment

Hi all, I'm using the WPFToolkit DataGrid control and I wanted to restyle some of the column headers so that the header text is displayed vertically instead of horizontally (the data in the column is all numeric and therefore, not very wide, but the header text is long). So I created a DataTemplate to and tried to get the DataGridColumn...

WPF DataGrid Hide RowDetails or Unselect Row

I have a DataGrid who's RowDetails is set to show when selected (RowDetailsVisibilityMode="VisibleWhenSelected"). Now I want to be able to get rid of it! I put a close button on the row details with this code: private void Button_Click(object sender, RoutedEventArgs e) { e.Handled = true; Button button = sender as Button; D...

WPF Datagrid binding to DataTable with complex type

Hi all, I have a class that contains data from some model. This class has metadata along with the actual value. class ServerValue { public int SomeId {get;} public int SomeOtherId {get;} public DateTime LastChanged {get;} public object Value {get;set;} // this lets me show the value, but how do i update it from...

WPF: How do I set the focus on a datagrid?

I would like to set the focus on the first row of a data grid. This is what I have so far: Keyboard.Focus(ResultsGrid) If result.Count > 0 Then ResultsGrid.SelectedIndex = 0 End If This will set the focus to the datagrid, but not the row itself. ...

WPF Datagrid set the column values only when the row is left

Hello I have a simple class. When I use it in winforms binding, whenever I change a value of a cell and leave the cell, the property immediately get changed. Using WPF Datagrid, whenever i change a value of a cell, the property gets set only after I leave the row. That is problematic for me. What am I doing wrong? Here is my code: p...

WPF DataGrid programmatic multiple row selection

Is there anything simpler than sample below ? I do have observable collection ( "list" in the code ) bound to DataGrid lstLinks for (int i = 0; i < list.Count ; i++) { object rowItem = lstLinks.Items[i] ; DataGridRow visualItem = (DataGridRow)lstLinks.ItemContainerGenerator.ContainerFromItem(rowItem); if ( visualItem =...

Progress Bar restarts

I have a DataGrid and in the Data Template of a DataGridTemplateColumn, i have added a Progress bar. now every time when mouse overs the rows of the data grid. my progress bar restarts its value from 0. I actually changes the Background and border property of the Row from triggers which i have defined in the control template of the Data...

WPF Hide DataGridColumn via a binding

For some reason I can't hide WPF Toolkit's DataGridColumn. I am trying to do the following: <dg:DataGridTemplateColumn Header="Item Description" Visibility="{Binding IsReadOnly}"> <dg:DataGridTemplateColumn.CellTemplate> <DataTemplate> <TextBox Text="{Binding Path=ItemDescription}" /> </DataTemplate> </dg:DataGridTemplat...

WPF DataGrid does not scoll on drag

I have a strange problem with a WPF DataGrid from WPF Toolkit. The scrollbars appear correctly when the number of rows grows, and the scrolling works when you press up or down arrows on the scrollbar. The problem comes in when I try to drag the scrollbar on the datagrid. My page has a scroll viewer around it. When I click and drag the s...

Paste Functionality for WPF DataGrid with DataGridTemplateColumns

Hi. I recently started using the WPF Datagrid with DataGridTemplateColumns containing the WPF AutoCompleteBox, but I'm finding trouble in implementing Clipboard.Paste functionality for these DataGridTemplateColumns. I've managed to get Clipboard.Paste working with built-in DataGridColumns via Vishal's guide here, but it doesn't work wit...

WPF Toolkit DataGrid Performance Issue

Hi All, I am facing a performance issue with WPF Toolkit datagrid. In my application I have created a view containing multiple Data Grids (around 25) with about 5 rows in each grid. The grids are placed in an ListView, the problem I am facing is of rendering of my view. Can anyone guide me to resolve the issue. Thanks ...

WPF Binding to DataRow Columns

Hi, I've taken some sample code from http://sweux.com/blogs/smoura/index.php/wpf/2009/06/15/wpf-toolkit-datagrid-part-iv-templatecolumns-and-row-grouping/ that provides grouping of data in a WPF DataGrid. I'm modifying the example to use a DataTable instead of a Collection of entities. My problem is in translating a binding declaration...

WPF DataGrid default column types

Hi, I'm using a DataGrid to display 2 possible types of DataRow in a DataTable. One type has the column Parent = NULL and the other has Parent set to another DataRow in the same DataTable. The list of column in the DataTable is always different, so explicitly describing each column is not possible. I want to display a UserControl in ev...

"Input string was not in a correct format." Exception in WPF Datagrid

Hello, I have a BindingListCollectionView connected to the DataContext of a datagrid. The datagrid now shows the list of items of the BindingListCollectionView. But when I click on the last row to add a new item. I get an "Input string was not in a correct format." exception. When I step with the debugger through the WpfToolkit library...

WPF DataGrid - How to move keyboard focus to newly added row after tab press

WPF DataGrid add a new row if we press tab on last column of last row. But after adding the new row, the focus is moved to top row of the grid. How can we make sure that the focus is moved to the first column of new row? ...

how to change the value of DataGrid cell programatically?

I need to change the value of Datagrig cell with a content of a textbox. Is it possible? ...

WPF DataGrid Combobox

Hi All, I want to display a dropdown in the datagrid with different values the user can select from. Somehow I am not able to display a ComboBox, instead it just displays the value as if it were a normal TextColumn. Below is my code, <StackPanel Grid.Row="0"> <toolkit:DataGrid Name="definitionGrid" Margin="0,10,0,0" AutoGe...

Dependency Property WPF Grid

Hi All, I want to Bind the textblock text in WPF datagrid to a dependency property. Somehow, nothing gets displayed, but when I use the same textblock binding outside the grid, everything works fine. Below is my code, </Grid.RowDefinitions> <StackPanel Grid.Row="0"> <toolkit:DataGrid Name="definitionGrid" ...