datagrid

Binding IsReadOnly of a DataGridTextColumn to a DataGridTemplateColumn checkbox IsChecked

筅森魡賤 提交于 2019-12-24 16:14:17
问题 Basically, I have a DataGrid with several columns, and I want to enable (changing the IsReadOnly property) a DataGridTextColumn based on a CheckBox IsChecked , located in another DataGridTemplateColumn of the same DataGrid . Here is (the important part of) the code: <DataGrid Name="lstTags" Grid.Row="0" ItemsSource="{Binding Path = LinesCollection}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" AutoGenerateColumns="False" CanUserAddRows="False" CanUserDeleteRows="False"

Binding datatable to datagrid creates unnecessary rows

爷,独闯天下 提交于 2019-12-24 15:16:05
问题 I wrote code to bind a datatable to a datagrid. I tested the code with three double arrays read from three txt files. First array contains 1 2 3 with a tag of 'test1'. second array having 4 5 6 7 with test2. third one has 8 9 with test3. When I tested, data was populated on datagrid with extra rows like shown below. test1 test2 test3 1 0 0 2 0 0 3 0 0 0 4 0 0 5 0 0 6 0 0 7 0 0 0 8 0 0 9 My intention was to show the data test1 test2 test3 1 4 8 2 5 9 3 6 7 Here is the code: string[] filenames;

Group statistic

霸气de小男生 提交于 2019-12-24 14:28:22
问题 I want to make DataGrid with grouping like below My question is how to do that "Average value" in group header? Below is a huge xaml <DataGrid x:Name="dataGrid" Grid.Column="1" CanUserResizeRows="False" CanUserSortColumns="False" GridLinesVisibility="None" AutoGenerateColumns="False" ItemsSource="{Binding List}" HeadersVisibility="Column" Grid.IsSharedSizeScope="True"> <DataGrid.Columns> <DataGridTextColumn Binding="{Binding A}" Header="A"/> <DataGridTextColumn Binding="{Binding B}" Header="B

How to display nested datagrids in wpf?

点点圈 提交于 2019-12-24 14:22:54
问题 I have requirement on Nested datagrid in WPF. Parent Grid Shown Order information of Consumers.When User click the details in order information, need to be displayed ordered items details in child datagrid(Means Nested grid) within the parent row of order information. I need to populate the multiple nested datagrids For first row on click Edit Button I am getting related child grid. Second row on wards the output i am getting is a empty datagrid. If I debug data is binding using ItemSource

How to data bind DataGrid component without scrolling up?

扶醉桌前 提交于 2019-12-24 14:16:28
问题 I have a DataGrid component that I would like to update every 5 seconds. As rows are being added to this DataGrid I noticed that every update causes it to reset the scroll bar position to the top. How can I manage to keep the scroll bar at its previous position? 回答1: make a variable to store your last scroll position and use that. roughly something like: var lastScroll:Number = 0; private function creationCompleteHandler(event:FlexEvent):void{ stage.addEventListener(MouseEvent.MOUSE_UP,

How to rewrite this DataGrid MouseLeftButtonUp binding to MVVM?

本小妞迷上赌 提交于 2019-12-24 13:51:26
问题 I have a working MouseLeftButtonUp binding that I works from the View.cs but that I cannot get working from the Viewmodel.cs XAML: <DataGrid x:Name="PersonDataGrid" AutoGenerateColumns="False" SelectionMode="Single" SelectionUnit ="FullRow" ItemsSource="{Binding Person}" SelectedItem="{Binding SelectedPerson}" MouseLeftButtonUp="{Binding PersonDataGrid_CellClicked}" > View.cs: private void PersonDataGrid_CellClicked(object sender, MouseButtonEventArgs e) { if (SelectedPerson == null) return;

WPF XAML - Bind datagrid column to foreign key (Dataset)

╄→гoц情女王★ 提交于 2019-12-24 13:42:47
问题 I am developing a simple WPF application that talks to an Access 2000 database. I have used entity framework in the past, but it seems I am limited with an Access database. I managed to generate a DataSet xsd file, that contains mappings for each table and the relations between tables. The schema is shown below: To bind the data to a WPF datagrid, I set the DataContext to a DataSet, after filling it from various table adapters. I use the following C# to achieve this in the WPF code behind:

WPF - Change DataGridTemplateColumn cell background based on CheckBox value

风流意气都作罢 提交于 2019-12-24 13:26:38
问题 I need to change the background color of a DataGridTemplateColumn cell based on whether or not the CheckBox within the DataGridTemplateColumn is checked. Seems that this should be possible within xaml, how can I go about this? Column: <DataGridTemplateColumn Header="FSC-P" Width="SizeToHeader"> <DataGridTemplateColumn.CellTemplate> <DataTemplate> <CheckBox IsChecked="{Binding FSCP}" VerticalAlignment="Center" HorizontalAlignment="Center" /> </DataTemplate> </DataGridTemplateColumn

DataGrid not allowing to edit item

£可爱£侵袭症+ 提交于 2019-12-24 13:16:27
问题 I have a problem in Wpf DataGrid. I am adding values in datagrid's first column called Model Name`. below I am also giving my code to show the problem. So my problem is first column will show the values from database and the other columns can be writeable. All the values will save in some database table. when I use datagrid.Items.Add(data); then it gives the values in first column, works fine but if I start writing in other columns it gives error "Edititem is not allowed". Here is my code in

How to select all checkboxes by clicking on CheckBox column header of a DatagridCheckBox Column?

末鹿安然 提交于 2019-12-24 13:02:03
问题 I have a datagrid with one checkbox column. If anyone clicks on checkbox present in the column header, all check boxes present in that particular column should be checked. How can it be achieved using XAML? Xaml: <DataGrid AlternationCount="2" AutoGenerateColumns="False" ItemsSource="{Binding}" Height="325" HorizontalAlignment="Left" Margin="0,178,0,0" Name="dataGrid1" VerticalAlignment="Top" Width="733" > <DataGrid.Columns> <DataGridTemplateColumn> <DataGridTemplateColumn.Header> <CheckBox