datagrid

fixed row width in DataGrid quirk

戏子无情 提交于 2019-12-25 00:29:42
问题 I've got this issue: I've got a dataGrid where whenever I set the column to not be resizable, the width gets messed up; works: var myCol:DataGridColumn = new DataGridColumn("Title"); myCol.width = 180; doesn't work (width is about 40pixels): var myCol:DataGridColumn = new DataGridColumn("Title"); myCol.width = 180; myCol.resizable = false; has anyone come across this or know why this is happening? I'm ready to just create my own dataGrid class now... 回答1: One thing that has helped us in the

DataTemplate on DataGridColumnHeader WPF C#

谁说胖子不能爱 提交于 2019-12-24 23:05:08
问题 I am having trouble getting a DataTemplate to apply to all columns in a datagrid with dynamically generated columns. The ItemsSource is bound to a DataTable property in the VM. Everything other than the template is working just fine. This is all just initial proof of concept right now, so data is garbage, but need help with the proof of concept. Code as follows: View: <DataGrid AutGenerateColumns="true" ItemsSource={Binding xxx} etc...> <DataGrid.Columns> <DataGridTemplateColumn>

Add StackPanel to WPF DataGrid at runtime

人盡茶涼 提交于 2019-12-24 22:51:51
问题 I have a Datagrid that is being built dynamically from incoming data using the following: TableData = JObject.Parse(File.ReadAllText(@"Datainfo.json")); var listCols = new List<DataColumn>(); var rawData = new DataTable(); foreach (dynamic item in TableData.data) { string columnName = item.Column; var column = new DataColumn(columnName); string DataType = item.DataType; if (DataType == "Int" ) { column.DataType = Type.GetType("System.Int32"); } else { column.DataType = Type.GetType("System

Datagrid selects the wrong custom cell in my datagrid

爱⌒轻易说出口 提交于 2019-12-24 21:40:10
问题 I am working on a problem since a week soon, but I still couldn't make it work as expected. I have a DataGrid which has HBox with a CheckBox an a Label as itemRenderer (see Code below). When I tap in to the Cell the standard itemEditor pops up and lets you enter the content of the label. Thats the standard behavior. I works fine except for 2 problems: If I enter to much text, the horizontal srollbar pops up, and the cell is filled with that scrollbar. As you see I tried to set the

C# WPF - Load Image from bytearray into Datagrid

北城余情 提交于 2019-12-24 21:32:56
问题 I've got a WPF Form (I am totally a beginner in WPF) which contains a Datagrid . This Datagrid gets its Content by a simple List<AudioFile> . Inside the class Mp3File which extends AudioFile (It's inside a PCL) is a method called GetCoverAsByteArray() , which returns the cover of a loaded AudioFile as a byte[] . Now i want to show the cover Image in the DataGrid , but i don't know how to do it. Can you please help me? Here is the code i have so far: <DataGrid x:Name="tvFiles"

How to edit rows in a WPF DataGrid with a custom RowStyle

ε祈祈猫儿з 提交于 2019-12-24 20:39:41
问题 I need to put some data in a DataGrid , using a custom UserControl for each row. Displaying the data works just fine, but when I edit the fields in the custom UserControl , the bound data records don't change. If I use a ListBox to display the data instead, it all works as expected. But I would rather use the DataGrid, which allows for sorting and (hopefully) adding new records. To illustrate, here is a simple data class that I need to display (and edit) - persons and their spouses: public

Changing column based on header ComboBox selection

天大地大妈咪最大 提交于 2019-12-24 19:33:44
问题 So currently I have a DataGrid that looks like this: Current DataGridView The goal behind this is to create an import utility. The data received in CSV format isn't always structured the same way. The columns change order, sometimes they only provide partial data. I'd like for the user to be able to select where each column is directed. I'm running into a few problems and I was hoping someone more experienced could direct me. First, the type of the data entered is still restricted. So for

JQuery EasyUI datagrid url being called with a POST even when method=GET

一曲冷凌霜 提交于 2019-12-24 19:03:47
问题 I am just starting out JQuery and easyui. The datagrid control looks super but my URL is being called with a POST everytime, even though I am setting the method to GET. <table id="dg" title="Plan details" class="easyui-datagrid" style="width:550px;height:250px" url="/Plans" toolbar="#toolbar" method="GET" rownumbers="true" fitColumns="true" singleSelect="true"> <thead> <tr> <th field="name" width="50">Name</th> <th field="description" width="100">Description</th> </tr> </thead> </table> <div

SelectedRow of datagrid is not selected again after returning to same Page

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-24 19:03:30
问题 I have two different Pages called Select and Edit. Both of them shares same ViewModel named SalesAccountsViewModel. I have a DataGrid in Select Page as follows: Then I select it any Item from the DataGrid : Then I click on edit button on selected row as shown below: After that I am redirected to another Page as shown below: When I click on save button: I am again redirected to the Previous Page but can you see the first row? It is not Highlighted fully: Here is Select Page that I use: <Page x

Datagrid ObservableCollection for one row wpf

橙三吉。 提交于 2019-12-24 16:49:21
问题 I want to populate a datagrid with itemsource={Binding Model}. This is not working out. It seems as the datagrid does not understand how to display these properties. An easy but silly workaround works great: In viewmodel: Props= new ObservableCollection<MonitoringBinaryModel>(); _Model = new MonitoringBinaryModel(name); Props.Add(_Model); Then in xaml itemsource={Binding Props} Seems silly to create an observablecollection when its only suppose to hold one item. Is there a better way to make