wpfdatagrid

Spanning a Record Over Multiple Rows in WPF Toolkit's DataGrid

流过昼夜 提交于 2020-01-02 04:05:27
问题 Is it possible to style WPF Toolkit's DataGrid so a data record can span multiple rows. Example screen shot from a commercial control. Thanks, Ben 回答1: It is not possible with the toolkit DataGrid or GridView for a ListView, no. However you may have luck with your own implementation, as I recently discovered you can use GridViewHeaderRowPresenter (MSDN reference), set the Columns property to the columns you want: that will give you a header row. Then you can use GridViewRowPresenter (MSDN

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

旧街凉风 提交于 2020-01-01 10:53: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

Implement custom Copy and Paste in WPF DataGrid which works when there are no rows in it

爱⌒轻易说出口 提交于 2020-01-01 09:38:50
问题 I need to implement a custom copy + cut + paste for data (not text or CSV) to be copied between grids in a WPF application. Using standard ApplicationCommands and defining CommandBinding works really well but only if the DataGrid contains at least 1 row of data and when it's selected. When there are no rows or focus is not on any of them, all commands are disabled. To fix the problem I tried calling CommandManager.InvalidateRequerySuggested() and setting Focusable=true and/or FocusManager

WPF MVVMLight: Update DataGrid based on SelectedItem of another DataGrid

*爱你&永不变心* 提交于 2019-12-30 13:43:06
问题 Developing a WPF app using MVVMLight . My Model consists of an Attribute class and a DataSet class with an ObservableCollection<Attribute> property named Attributes . My MainViewModel has a DataSet property. In my MainView which has it's DataContext set to MainViewModel I have two DataGrids . One has it's ItemsSource binded to DataSet.Attributes which works fine: <DataGrid CanUserAddRows="false" AutoGenerateColumns="false" ItemsSource="{Binding DataSet.Attributes}"> //some DataGrid columns

Programmatically scrolling WPF 4 DataGrid to end

旧街凉风 提交于 2019-12-30 11:12:20
问题 Does anyone know of a reliable approach for scrolling a WPF DataGrid (.NET 4) to the last row programmatically? I'm aware of ScrollIntoView(Items[Items.Count-1]) , but this works only if the items are unique. For instance, consider the following DataGrid which displays all the installed cultures, followed by all the installed cultures: var cultures = System.Globalization.CultureInfo.GetCultures (System.Globalization.CultureTypes.AllCultures); var timesTwo = cultures.Concat (cultures).ToArray(

WPF DataGridTemplateColumn. Am I missing something?

不想你离开。 提交于 2019-12-30 09:05:13
问题 <data:DataGridTemplateColumn Header="Name"> <data:DataGridTemplateColumn.CellTemplate> <DataTemplate> <TextBlock Text="{Binding Name}"> </DataTemplate> </data:DataGridTemplateColumn.CellTemplate> <data:DataGridTemplateColumn.CellEditingTemplate> <DataTemplate> <TextBox Text="{Binding Name}"> </DataTemplate> </data:DataGridTemplateColumn.CellEditingTemplate> </data:DataGridTemplateColumn> It's clear example of Template column, right? What could be wrong with that? So, here is the thing - when

Getting WPF Data Grid Context Menu Click Row

家住魔仙堡 提交于 2019-12-29 17:42:47
问题 I have a WPF DataGrid <DataGrid AutoGenerateColumns="False" Name="dataGrid1" IsReadOnly="True" > <DataGrid.Columns> <DataGridTextColumn Header="Site" Binding="{Binding Site}" Width="150" /> <DataGridTextColumn Header="Subject" Binding="{Binding Subject}" Width="310" /> </DataGrid.Columns> <DataGrid.ContextMenu> <ContextMenu> <MenuItem Header="Delete" Click="Context_Delete"> <MenuItem.Icon> <Image Width="12" Height="12" Source="Images/Delete.png" /> </MenuItem.Icon> </MenuItem> </ContextMenu>

Hide Datagrid Column based on its Property name

安稳与你 提交于 2019-12-29 09:17:10
问题 I have a DataGrid defined as follows : <DataGrid Name="dtMydatagrid" Margin="10,10,10,10" RowHeight="20" AutoGenerateColumns="True" ItemsSource="{Binding}" Height="auto" Width="auto"> <DataGrid.Columns> <DataGridTemplateColumn Header=""> <DataGridTemplateColumn.CellTemplate> <DataTemplate> <TextBox x:Name="TXT" Background="Transparent" Width="15" IsReadOnly="True" Visibility="Hidden" Margin="0,0,0,0"/> <DataTemplate.Triggers> <DataTrigger Binding="{Binding Path=IsBKM}" Value="true"> <Setter

Select DataGridCell from DataGrid

不想你离开。 提交于 2019-12-29 07:35:09
问题 I have a DataGrid WPF control and I want to get a specific DataGridCell . I know the row and column indices. How can I do this? I need the DataGridCell because I have to have access to its Content. So if I have (for example) a column of DataGridTextColum , my Content will be a TextBlock object. 回答1: You can use code similar to this to select a cell: var dataGridCellInfo = new DataGridCellInfo( dataGrid.Items[rowNo], dataGrid.Columns[colNo]); dataGrid.SelectedCells.Clear(); dataGrid

How to set the DataSource of a DataGrid in WPF?

霸气de小男生 提交于 2019-12-29 06:13:48
问题 I need to set a table from a database to be the DataSource of a GridGrid in WPF. In Windows Forms the property is called DataSource but in WPF no such property exists, so how can i do it? 回答1: You can use the ItemsSource property : <ListView ItemsSource="{Binding YourData}"> <ListView.View> <GridView> <!-- The columns here --> </GridView> </ListView.View> </ListView> If you prefer to use code-behind rather than a binding, just give a name to the ListView and set the ItemsSource property in