wpfdatagrid

Slow and Stuttery WPF Grid Scrolling when loaded with large amounts of data (40 columns, 2000 rows)

▼魔方 西西 提交于 2019-12-04 07:28:15
In a nutshell we're unable to get reasonable scrolling performance from any kind of WPF grid/items control when loaded with heavy amounts of pure data. We've created a static independent prototype using the DevExpress WPF grid and uploaded it here: http://jump.fm/QOTDL We've also tried with the Infragistics and Xceed grid, and the problem is the same. It seems like WPF simply cannot cope with reasonably large data grids displaying lots of data as far as providing a smooth user experience goes. Even without any kind of databinding, simply providing static data (~40 columns wide, 2000 rows),

Determine who has focus in WPF Window

旧城冷巷雨未停 提交于 2019-12-04 07:12:04
We are using WPF and have a window derived from a DockingLibrary. This window has a grid with multiple items in it, one being a WPF datagrid. We are using the M-V-VM pattern. When this windown is created and shown, none of the rows in this datagrid are selected. We can set the row to display as highlighted by doing something like: SharedWindow.ShipmentWin.shipmentDataGrid.SelectedIndex = 0; This causes the first row in the datagrid to be shown as highlighted. But, and isn't there always one of these, this row is not Selected nor does it have Focus. I tried setting IsSelected and Focus on this

Datagrid selectedItem and databinding

可紊 提交于 2019-12-04 07:03:58
I have two datagrid displayed on my UI. When I select a particular row on datagrid 1, I would like to display the details of the datagrid 1 on datagrid 2. I am populating the datagrid data from a database. here is the two database table structure. Note: both the table are mapped by the personid in the database here is the code so far I have tried Baseclass.cs public class Baseclass { public event PropertyChangedEventHandler PropertyChanged; protected void SetProperty<T>(ref T member, T value, [CallerMemberName] string propertyName = null) { member = value; this.RaiseNotification(propertyName);

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

为君一笑 提交于 2019-12-04 05:33:27
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? You could try something like this.SelectRowCell(this.Items.Count - 1, 0); But I'm not sure if that will set the focus too. If not then try the following: DataGridCell cell = this.GetCell(this.Items.Count - 1, 0); if (cell != null) { cell.Focus(); } 来源: https://stackoverflow.com/questions/2645027/wpf-datagrid-how-to-move-keyboard-focus-to-newly-added-row-after-tab-press

How to set/reset Three-state checkbox value in WPF

牧云@^-^@ 提交于 2019-12-04 05:23:14
I have a datagrid whose one of the header column is Three-state checkbox. The celltemplate for that column contains two state checkbox + AllItems CheckBox - Item1 - Item2 - Item3 .. I wanted to use AllItems checkbox to select/unselect all items (item1,item2) which works fine. Next I wanted to set AllItems checkbox to intermediate state when not all items are selected/unselected. Similarly I wanted to set AllItems checkbox as checked/unchecked when all items get manually selected. Here is the code that I tried... <dg:DataGridTemplateColumn.HeaderTemplate> <DataTemplate> <StackPanel x:Name=

How to edit wpfdatagrid other cells while one of it's cell is invalid?

∥☆過路亽.° 提交于 2019-12-04 04:27:28
问题 In WPF datagrid ,When a cell is invalid,it prevents the the other cells editing so user can not enter data until the invalid cell comes valid.I was wonder if there is a way to disable this behavior? There is how i use datagrid : <DataGrid ItemsSource="{Binding ..}"> <DataGrid.Columns> <DataGridTextColumn Header="Name" Binding="{Binding Name , UpdateSourceTrigger=PropertyChanged , NotifyOnValidationError=True , ValidatesOnDataErrors=True , ValidatesOnExceptions=True}" </DataGridTextColumn> <

How do I get around this lambda expression outer variable issue?

给你一囗甜甜゛ 提交于 2019-12-04 03:49:58
问题 I'm playing with PropertyDescriptor and ICustomTypeDescriptor (still) trying to bind a WPF DataGrid to an object, for which the data is stored in a Dictionary. Since if you pass WPF DataGrid a list of Dictionary objects it will auto generate columns based on the public properties of a dictionary (Comparer, Count, Keys and Values) my Person subclasses Dictionary and implements ICustomTypeDescriptor. ICustomTypeDescriptor defines a GetProperties method which returns a

WPF DataBinding Error: Cannot find source for binding with reference 'RelativeSource FindAncestor'

柔情痞子 提交于 2019-12-04 02:57:58
问题 I get the following errors from the code below... not sure why (and yes, it produces all 4 even though it's the same 2 repeated). Oh, and it doesn't produce the alternating rows effect, even though prior to these errors popping up the same code was working. System.Windows.Data Error: 4 : Cannot find source for binding with reference 'RelativeSource FindAncestor, AncestorType='System.Windows.Controls.DataGrid', AncestorLevel='1''. BindingExpression:Path=AreRowDetailsFrozen; DataItem=null;

Retain DataGrid IsSelectionActive when a ContextMenu opens in WPF?

孤街浪徒 提交于 2019-12-04 02:45:50
I have a DataGrid which has a style for IsSelectionActive ; however, as soon as the ContextMenu opens, the grid loses IsSelectionActive and it looks like to the user that as if the context menu somehow took the selection and may confuse the user. Is there a way to retain IsSelectionActive when a context menu opens? <ControlTemplate.Triggers> <MultiTrigger> <MultiTrigger.Conditions> <!--<Condition Property="Selector.IsFocused" Value="True" />--> <Condition Property="IsSelected" Value="True" /> </MultiTrigger.Conditions> <Setter Property="Background" Value="Red" /> </MultiTrigger> <MultiTrigger>

WPF datagrid: disable editing in certain rows

假如想象 提交于 2019-12-04 02:44:07
I have something like orders table bound to a DataGrid . I want to disable editing on rows, where order date is expired (deadline date > current date): show them greyed and ban entering into edit mode. Here is what I have: <Style TargetType="{x:Type WPFToolkit:DataGridRow}"> <Style.Triggers> <MultiTrigger> <MultiTrigger.Conditions> <!-- ??? order_date > current_date --> <!-- some other condition - already works --> </MultiTrigger.Conditions> <Setter Property="IsEnabled" Value="False"/> <Setter Property="Foreground" Value="LightGray"/> </MultiTrigger> </Style.Triggers> </Style> The order date