wpfdatagrid

Frozen rows in WPF DataGrid?

穿精又带淫゛_ 提交于 2019-12-22 08:14:38
问题 Does anyone have some code that freezes rows on top in the WPF DataGrid, with Virtualization turned on? We see some code out there without Virtualization off, but we need it with Virtualization on. some links which works only for non-virtualized DataGrid Freeze DataGrid Row scrollable gridview with fixed searched row in datagrid using wpf How does WPF DataGrid get frozen rows/columns working? 来源: https://stackoverflow.com/questions/22731690/frozen-rows-in-wpf-datagrid

MvvmLight EventToCommand and WPFToolkit DataGrid double-click

拜拜、爱过 提交于 2019-12-22 06:58:31
问题 Trying to figure out how to use EventToCommand to set a datagrid double click handler for rows. The command lives in the viewmodel for each row. Just that much out of my experience, since I haven't used interactions yet. Thanks. I would have used mvvmlight tag, but I don't have high enough rep yet to make new tags. 回答1: This would be the solution if the Command lives on the "GridVieModel" and not on the "RowViewModel". <Window... ...xmlns:dg="clr-namespace:Microsoft.Windows.Controls;assembly

WPF DataGrid - highlight new rows when inserted into datagrid

北城以北 提交于 2019-12-22 05:51:44
问题 I have a datagrid bound to an ObservableCollection, and what I'd like to do is highlight new rows when they are added to the datagrid (i.e. when a new object is inserted into the ObservableCollection). I'd like to highlight the rows when they are inserted by changing the background colour initially, but then having the colour fade back to normal over time. I've tried a variety of different methods to get it to work but nothing quite works properly. Method 1: I have an event trigger that fires

WPF Datagrid COMException on using IncludeHeader ClipboardCopyMode

蓝咒 提交于 2019-12-22 04:06:18
问题 In my WPF app, I am using a Datagrid control; in the control definition I defined ClipboardCopyMode property as 'IncludeHeader'. <DataGrid Name="datagrid" ClipboardCopyMode="IncludeHeader"> </DataGrid> At times, when I try to copy any data from grid, I am encountering HRESULT clipboard crash error - System.Runtime.InteropServices.COMException (0x800401D0): OpenClipboard Failed (Exception from HRESULT: 0x800401D0 (CLIPBRD_E_CANT_OPEN)) Any suggestions to resolve it. I looked at other posts,

WPF: Copy from a DataGrid

痴心易碎 提交于 2019-12-22 04:02:42
问题 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.) 回答1: In the DataGrid's ContextMenu , you can create a MenuItem and set the MenuItem.Command value to Copy. It's a Command available through the standard ApplicationCommands list, so there won't be any additional code required to have it functional: <DataGrid> <DataGrid.ContextMenu> <ContextMenu

WPF. How to stop data trigger animation through binding?

岁酱吖の 提交于 2019-12-22 03:19:27
问题 In WPF toolkit datagrid I have a data trigger bound to opacity of cell element. When UpVisibility changes to 1 the path become visible and the animation starts to fade it to 0. Which works. However my problem now - if I need to prematurely stop/cancel the fading and am setting UpVisibility to 0 the Path is still visible and fading as nothing happened.... How to drop opacity to 0 instantly using MyValue object ? <Path Data="M 5,0 0,10 10,10" Height="10" Width="10" Fill="Green" Opacity="

How to bind the same collection of values into all ComboBoxes in a DataGridComboBox?

▼魔方 西西 提交于 2019-12-21 23:39:03
问题 I have a Collection of Values in an Array of Strings, or in a List or whatever, and what i want is to set this Collection of values as the Collection of items into all the ComboBoxes in a column as DataGridComboBoxColumn in WPF. I think i don't have other way to access this Collection of Values and bind it equally to all the ComboBoxes (in XAML) beside the DataContext. But can i access the DataContext of a DataGrid from a DatGridComboBoxColumn (in XAML)? Can i do it? How? How i specify (in

Drag Drop Row behavior on WPF DataGrid

有些话、适合烂在心里 提交于 2019-12-21 20:45:22
问题 I am trying to make an attached behavior to reorder rows bby doing Drag & Drop I found some solution (On Stackoverflow and by googling) and using them i am trying to make the behavior... I took the example from Hordcodenet website (i dont have the link now) Code public static class DragDropRowBehavior { private static DataGrid dataGrid; private static Popup popup; private static bool enable; private static object draggedItem; public static object DraggedItem { get { return DragDropRowBehavior

WPF DataGrid: resizing columns

ε祈祈猫儿з 提交于 2019-12-21 20:42:47
问题 I have a System.Windows.Controls.DataGrid with property CanUserResizeColumns assigned to True. Now I can adjust the width of the columns by using the mouse left button click between 2 column headers. But I also want to be able to change the width of the columns in any row of the dataGrid, not only in the column headers. Is it possible? 回答1: In your dataGrid you can use a DataGridTemplate column alogn with a GridSplitter to achieve this.. <toolkit:DataGridTemplateColumn Header="Text" >

WPF Hide DataGridColumn via a binding

不打扰是莪最后的温柔 提交于 2019-12-21 20:29:10
问题 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:DataGridTemplateColumn.CellTemplate> This doesn't work, since it's looking for a IsReadOnly property on the ItemSource (not a property of the current class). If add this as a property of the