datagrid

setting fuelux datagrid source from backbone collection

独自空忆成欢 提交于 2020-01-11 12:34:28
问题 I am trying to set the fuelux datagrid source from my backbone collection. The examples source is here on https://github.com/ExactTarget/fuelux/tree/master/sample . I tired like (function (root, factory) { if (typeof define === 'function' && define.amd) { define(factory); } else { root.sampleData = factory(); } }(this, function () { return { "geonames": new mycollection ///this will retrurn new collection array as in example }; })); And my backbone render consist following code to instatate

How to display a list of list in DataGrid( WPF) using c#

五迷三道 提交于 2020-01-11 12:00:12
问题 I have a List of headers(columns) and then rows of data and want to show it in DataGrid with two way bindings List<string> headers = new List<string> { "FirstName", "LastName", "Age" }; List<string> row1 = new List<string> { "John", "Doe", "19" }; List<string> row2 = new List<string> { "Jane", "Doe", "21" }; List<string> row3 = new List<string> { "Suzie", "Q", "52" }; List<string> row4 = new List<string> { "No", "Body", "48" }; List<List<string>> tableValues = new List<List<string>> { row1,

Show Image in dynamically generated DataGrid.Columns in WPF

我怕爱的太早我们不能终老 提交于 2020-01-11 10:27:50
问题 I've to pivot information data from a query, and show images based on value read from the underlying database. Let's say I have this data out of my query: Identifiant|ProcessId|AlarmLevel BOUDA25 | 100 | 1 BOUDA25 | 110 | 1 BOUDA25 | 130 | 1 BOUDA25 | 205 | 2 BOUDA25 | 210 | 2 I now want to make the following WPF DataGrid display the actual images represented by images/circle_orange.ico , etc. So far my code resembles this: private void PopulateGrid(IEnumerable<AlarmeViewModel> alarmes) { //

WPF Datagrid “Select All” button - “Unselect All” too?

旧时模样 提交于 2020-01-11 04:45:09
问题 I would like to know if it would be possible to add functionality to the 'Select All' button in the top left of a datagrid so that it also unselects all rows? I have a method attached to a button which does this, but it would be great if I could fire this method from the Select All button, to keep functionality in the same part of the view. Can this 'Select All' button have code added to it, and if so, how would one get to the button? I haven't been able to find any examples or suggestions.

grid.mvc use filtered Result in Controller

十年热恋 提交于 2020-01-11 03:59:47
问题 I'am using grid.mvc(http://gridmvc.codeplex.com/) for filtering and sorting. Does anybody know how to process the filtered result in an action controller. I'm trying to pass a hidden field via FormCollection, but cause of paging only the visible Values are passed. Or is there any good alternative grid in mvc where you can filter and sort and use the filtered result for an action in and MVCController? _customersGrid.cshtml @using GridMvc.Html @using GridMvc.Site.Models @using GridMvc.Sorting

WPF Popup focus in data grid

心不动则不痛 提交于 2020-01-10 02:02:22
问题 I'm creating a custom UserControl to be used inside a DataGrid editing template. It looks like this: <UserControl x:Class="HR.Controls.UserPicker" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:tk="http://schemas.microsoft.com/wpf/2008/toolkit" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> <Grid> <TextBlock x:Name="PART_TextBox" Text="Hello WOrld" /> <Popup Width="234" Height="175" IsOpen="True" StaysOpen="True" Placement="Bottom" PlacementTarget="{Binding

WPF datagrid “EditItem is not allowed for this view” exception

好久不见. 提交于 2020-01-09 11:19:08
问题 I programmatically add DataGrid : System.Windows.Controls.DataGrid dataGrid = new System.Windows.Controls.DataGrid(); dataGrid.GridLinesVisibility = DataGridGridLinesVisibility.None; dataGrid.HorizontalScrollBarVisibility = ScrollBarVisibility.Hidden; dataGrid.Background = Brushes.White; DataGridTextColumn textColumn = new DataGridTextColumn(); textColumn.Width = 250; textColumn.Header = "Account"; textColumn.Binding = new Binding("Account"); dataGrid.Columns.Add(textColumn); When I add Item:

Merge Cells in WPF DataGrid

六眼飞鱼酱① 提交于 2020-01-09 03:33:05
问题 I want to create a WPF datagrid that spans over multiple rows in one column. Like this: +-------+----------------+ | Name | Attributes | +-------+----------------+ | | Horse Power | | BMW +----------------+ | | Color | +-------+----------------+ | | Weight | | Ford +----------------+ | | Color | +-------+----------------+ How can the following code be changed to get it done? <DataGrid AutoGenerateColumns="False"> <DataGrid.Columns> <DataGridTextColumn Header="Name" /> <DataGridTextColumn

MVVM项目中的动态DataGrid单元样式

試著忘記壹切 提交于 2020-01-08 23:17:28
目录 介绍 先决条件 使用代码 转换器 数据网格绑定 按钮绑定 结论 下载源代码和项目文件-397.4 KB 介绍 这个小应用程序演示了一种基于 DataGrid 单元格内容动态修改单元格样式的方法。动态样式的一个示例:如果单元格中的值变为负数,则可能需要将单元格的背景色更改为红色。尤其强调了 Model-View-ViewModel ( MVVM )模式来演示此样式。我提供完整的 Visual Studio 源代码和其他项目文件。可以从 本文头部下载该项目的工作示例。在应用程序中,每当用户单击 [CHANGE VALUES] 时 , DataGrid 中的单元格就会填充 1 到 9 的新随机整数。单元格的背景颜色会根据单元格的新内容而变化。 先决条件 该解决方案是使用 Visual Studio 2019 社区版 16.3.9 版和 .NET 4.7.2 构建的。它还需要 Expression.Blend.Sdk 版本 1.0.2 ,但是此 SDK 与项目文件打包在一起。 还假定读者对 C # WPF 项目和 MVVM 模式有基本的了解。 使用代码 当您生成并运行代码时,将出现以下窗口: 注意 :单元格中的整数是由随机生成器生成的,每次运行代码时以及每次单击 [CHANGE VALUES] 按钮时都会不同。我意识到颜色有点扎眼,但目的是清楚地显示当 DataGrid

WPF DataGrid标题Header Binding失效

旧城冷巷雨未停 提交于 2020-01-07 18:53:26
前言: 因业务需要对 WPF 中的 DataGrid 控件中的 行数进行统计 ,同时把统计的行数 显示在列标题上 。 如果我们用常规的 Binding 手段 更新DataGridTextColunm 的 Header 的话是 不会生效 的,因为WPF中 视觉树 中 没有DataGridTextColumn 元素来映射它 (DataGridTextColumn不是控件,因此它没有父控件) 。 错误示范: <DataGridTextColumn Binding="{Binding Test}" Header="{Binding ColName}"/> 因为 视觉树 的机制,我们只需要把列标题 视为一个控件 即可 (注:Header属性会失效,需要初始化Binding的字段) : <DataGridTextColumn Binding="{Binding Test}"Header="列名"> <DataGridTextColumn.HeaderTemplate> <DataTemplate> <TextBlock Text="{Binding DataContext.ColName,UpdateSourceTrigger=PropertyChanged,Mode=TwoWay, RelativeSource={RelativeSource AncestorType=DataGrid}}"