datagrid

How to programmatically form an observable collection and bind it to a datagrid

一个人想着一个人 提交于 2020-01-07 03:40:53
问题 I have a problem which i'd divide in two steps: Problem1. Form an observable collection of strings and bind it to a datagrid ObservableCollection<string[]> octest = new ObservableCollection<string[]>(); var el = new string[6] {"1","2","3", "4", "5", "6" }; octest.Add(el); octest.Add(el); octest.Add(el); dtgResults.ItemsSource = octest; the problem is that the binding results in the image below: Problem 2 The same but now with an array of strings but with mixed elements (e.g. 3 strings and 3

DataGrid repeats the data retrieved from database in a single row twice

偶尔善良 提交于 2020-01-07 03:25:34
问题 I am working on a point of sale project in WPF and i want to retrieve all the records (associated with the current or last customer id) in to datagrid. I have done the same work in other project while selecting the * from a table and retrieving it. But this time don't know why this code doesn't work.i am including the output image with my question kindly have a look at that too. <DataGrid x:Name="dataGrid" ItemsSource="{Binding DataSource}" HorizontalAlignment="Left" Margin="115,312,0,0"

Programmatically add columns to datagrid not compiling

左心房为你撑大大i 提交于 2020-01-07 03:09:45
问题 This is the continuation to OnEvent datagrid column add fail I have seen this post: How to add Data to a WPF datagrid programatically the datagrid is simply this: <DataGrid Name="dtgResults" Background="Transparent" AutoGenerateColumns="False"/> in which everything seems to work fine but when I put it in my solution it doesn't compile: Can anyone explain me why? ---EDIT--- I realize now that I have misunderstood what's in the link above. In short I have a datagrid binded to an observable

Binding 2d array with WPF DataGrid2D

橙三吉。 提交于 2020-01-07 02:38:05
问题 I'm tryng to bind a 2 dimensional array to a DataGrid in WPF. I found this library DataGrid2D but I make some mistake because it does not display the correct result but an empty grid. This is my XAML code: ..... xmlns:dataGrid2D="http://gu.se/DataGrid2D" .... <Grid> <DataGrid Name="matrix" dataGrid2D:ItemsSource.Array2D="{Binding Data2D}" dataGrid2D:ItemsSource.ColumnHeadersSource="{Binding ColumnHeaders}" dataGrid2D:ItemsSource.RowHeadersSource="{Binding RowHeaders}" /> </Grid> And this is

WPF Control DataGrid Cell Color Change

╄→гoц情女王★ 提交于 2020-01-07 01:48:35
问题 I come to write my first WPF Control. It contains a DataGrid filled with data. Change the font of some of the cells based by function that I call in the main form.Its here I really hit rock bottom.Anyone has ideas? ========================================================================= I Looked in the topic above and still can't get my head around how to make it function that is dynamically called from the control in the main form. Here is the Code I am working on so far. public void

How to Bind ComboBox inside a Datagrid?

落爺英雄遲暮 提交于 2020-01-06 20:34:50
问题 I have a table called groups as shown below : After looking at the image above I think you might have understood that primary key and foreign key exist in the same table. I think this is what developers call cyclic reference. In MainWindow.xaml I have a DataGrid which contains three columns namely Group Name, Parent Name, Description. The xaml looks like : <Window .......> <Window.DataContext> <self:MainWindowViewModel /> </Window.DataContext> <DataGrid ItemsSource="{Binding Groups}" TabIndex

Controller method is not hitting in Datatables C# MVC

亡梦爱人 提交于 2020-01-06 19:42:22
问题 I am using Datatables in my application, but to fetch the data controller method is not getting triggered. I am able to render the table on UI, but the data is coming is NULL. Here is my code Imported items in SITE.MASTER <link href="/Scripts/DataTables/media/css/demo_page.css" type="text/css" rel="stylesheet" /> <link href="/Scripts/DataTables/media/css/demo_table.css" type="text/css" rel="stylesheet" /> <script src="/Scripts/Lib/jquery-1.4.2.js" type="text/javascript" language="javascript">

How can I create a custom MXAdvancedDataGridItemRenderer in Flex4?

旧巷老猫 提交于 2020-01-06 19:35:07
问题 Well, I created one but it has a bunch of issues: if I click in the rendered column I get an error: TypeError: Error #1009: Cannot access a property or method of a null object reference. at Test/clickHandler()[C:\Documents and Settings\NDEGRAEV\workspace-dummy\Test\src\Test.mxml:27] at Test/___Test_AdvancedDataGrid1_click()[C:\Documents and Settings\NDEGRAEV\workspace-dummy\Test\src\Test.mxml:31] the text is stuck to the top left corner of the cell; the cell's background doesn't change to the

Do this in C# code instead of template XAML

孤街浪徒 提交于 2020-01-06 19:34:53
问题 Is there a way to make column of cells in a Silverlight datagrid be readonly in editmode with C# code instead of setting up a entire datagrid as a template in a resource file? UPDATE Found an example piece of code - http://forums.silverlight.net/forums/p/17483/58189.aspx In the response by slhungry midway into the thread. He has example code written as a XAML template. Can you write this in C#? 回答1: Well, you can certainly create DataGridColumns programmatically in your codebehind and add

Flex DataGrid column sort descending not working

夙愿已清 提交于 2020-01-06 18:07:15
问题 I'm having a strange problem. In Flex 4, I have a Spark DataGrid and have both an item renderer and a sort compare function defined for one of the columns. Strangely, this column will not sort in descending order. The data is originally not sorted. Clicking on the column header displays the "up" arrow and the data sorts in ascending order. However, clicking on the column header again does nothing. The "up" arrow stays and the data stays sorted in ascending order. I have debugged through the