wpfdatagrid

WPF 4: What happened to DataGridColumnHeader?

无人久伴 提交于 2019-12-23 09:15:05
问题 What happened to DataGridColumnHeader? It looks like it was dropped when the DataGrid was moved into PresentationFramework. 回答1: DataGridColumnHeader is under the System.Windows.Controls.Primitives namespace in the PresentationFramework.dll assembly. 回答2: Something like <DataGrid ItemsSource="{Binding}"> <DataGrid.Columns> <DataGridTextColumn Header="Column Name" Binding="{Binding Name, Mode=TwoWay}" /> </DataGrid.Columns> </DataGrid> 来源: https://stackoverflow.com/questions/2481946/wpf-4-what

Freezing columns in wpf datagrid

…衆ロ難τιáo~ 提交于 2019-12-23 06:49:31
问题 I have some tabular data which has a lot of fields in it, and when my WPF application is resized a lot of them are cut off. However, I want to see the first 6 columns always as they are important. How can I achieve this in a grid format? I am using the WPFToolkit DataGrid but can be persuaded to change to a different control if one exists. Right now, I am using two different DataGrids side by side with the right most datagrid inside a scrollviewer with horizontal scrolling on and the vertical

DataGrid Rows' Foreground color for selected item

家住魔仙堡 提交于 2019-12-23 05:12:46
问题 I have a RowStyle defined for my DataGrid to change the Foreground color to red for items in my grid that have a rejected status or Reject_X or Reject_Y: <Style TargetType="DataGridRow"> <Style.Triggers> <DataTrigger Binding="{Binding Status}" Value="{x:Static StatusTypes:Status.Reject_X}"> <Setter Property="Foreground" Value="Red"/> </DataTrigger> <DataTrigger Binding="{Binding Status}" Value="{x:Static StatusTypes:Status.Reject_Y}"> <Setter Property="Foreground" Value="Red"/> </DataTrigger>

2-Way databinding with Entity Framework and WPF DataGrid

倾然丶 夕夏残阳落幕 提交于 2019-12-23 03:24:24
问题 I'm having trouble adding an Entity Framework entity to a ObjectContext's EntitySet automatically using the WPF 4.0 DataGrid's add functionality. Here's the setup: DataGrid-->BoundTo-->ListCollectionView-->BoundTo-->EntitySet When I interactively add a row to the DataGrid, the EntitySet does not have a new entity added to it. Updating the row's cell data does in fact update the bound entity's properties, however. Any idea what I could be doing wrong? Here is the XAML for the

WPF DataGrid with TreeView type hierarchy

泪湿孤枕 提交于 2019-12-23 02:16:43
问题 Is it possible to have a pure hierarchical wpf data grid? Now there are 3 possible solutions dicussed over the internet ... GroupStyle TreeListView instead of DataGrid RowDetailsTemplate Now all 3 are not useful in my case as they each have limitations. GroupStyle provides grouped row presenters but their parent is simply GroupItem . This is where my data source is different. In my case the parent of the grouped items will be of the same type of item. e.g. Folder class has List<Folders>

Grouping data on Datagrid wpf

最后都变了- 提交于 2019-12-22 18:47:10
问题 I want to regroup my data with an expander that contains the group name and contains all ClassMate name inside. This is my class Group : public class Group{ public List<ClassMate> CLGroup { get; set; } public string GroupName { get; set; }} My classMate class : public class ClassMate: INotifyPropertyChanged{ public string Name { get; set; } public string DisplayName { get; set; }} I tried to do this with this Xaml but I don't know why it's not working <DataGrid x:Name="gridMates" ItemsSource=

WPF Datagrid group expander text - how to bind?

天涯浪子 提交于 2019-12-22 18:28:23
问题 I am using a datagrid with a combox that should change the grouping field. I am using the following xaml to define the general grouping template : <DataGrid.GroupStyle> <GroupStyle> <GroupStyle.ContainerStyle> <Style TargetType="{x:Type GroupItem}"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type GroupItem}"> <Expander> <Expander.Header> <StackPanel Orientation="Horizontal"> <TextBlock Text="NEEDS TO BE BINDED..."/> </StackPanel> </Expander.Header>

Implement “drag and fill” functionality in WPF datagrid

こ雲淡風輕ζ 提交于 2019-12-22 11:00:01
问题 We are developing an app that utilises a data grid. Most of the grid's functionality will be fairly standard stuff - styling cells, in-cell editing, sorting, etc. However one requirement is to provide "drag and fill" functionality, like Excel. This is where you select one or more cells inside a row, which then get a thick border drawn around them. The border has a small square on its bottom-right corner, and when you drag this down Excel copies the selected cell values to the rows below. This

How to get field that datagrid column is bound to?

感情迁移 提交于 2019-12-22 10:53:31
问题 In my xaml I have modified each column header to include a button. For the command parameter I would like to use the column's data field name, instead of the header content. E.g. Instead of "Job Title" which is what the header content is, I want "JOB_TITLE". For header content I would use: <Button Command="{Binding DataContext.OpenFilterCommand, RelativeSource={RelativeSource AncestorType=UserControl}}" CommandParameter="{TemplateBinding Content}"> How do I get the actual field name? 回答1: If

How do I load a DataGrid with data from a database using WPF and MVVM?

≯℡__Kan透↙ 提交于 2019-12-22 09:57:06
问题 I am a complete newbie to WPF and MVVM so I apologise in advance if this query is quite simple. I've searched online and havent been able to find anything which fits my requirements. Hense why I'm here! I am currently trying to implement a table of data queried from a database using LINQ. This is the query I run: DataContext connection = new DataContext(); var getTripInformation = from m in connection.tblTrips where m.TripDate > DateTime.Today select new { m.TripID, m.TripName, m.TripDate, m