datagrid

WPF 自带Datagrid编辑后无法更新数据源的问题

孤人 提交于 2020-03-04 21:50:18
最近项目中遇到的问题,datagrid编辑后无法立刻与后台同步,只有失去焦点时才更新,在网上找了找,这个方法可以用用: 转自: http://blog.csdn.net/lianchangshuai/article/details/7787344 解决办法: 在列的绑定属性里加上UpdateSourceTrigger,示例XAML如下 <DataGrid Grid.Row="1" Height="274" HorizontalAlignment="Left" Margin="12,10,0,0" Name="dataGrid2" VerticalAlignment="Top" Width="679" RowEditEnding="dataGrid2_RowEditEnding" AutoGenerateColumns="False"> <DataGrid.Columns> <DataGridTextColumn Header="姓名" Width="*" Binding="{Binding Name,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"/> <DataGridTextColumn Header="地址" Width="*" Binding="{Binding Addr,Mode=TwoWay

WPF中DataGrid使用初步

孤者浪人 提交于 2020-03-04 21:48:46
(1)自动生成列 <DataGrid AutoGenerateColumns="True" Name="datagrid" CanUserAddRows="False" MouseDoubleClick="datagrid_MouseDoubleClick" /> (2)取消自动生成列,手动绑定到相应字段 <DataGrid AutoGenerateColumns="False" Name="datagrid" CanUserAddRows="False" MouseDoubleClick="datagrid_MouseDoubleClick"> <DataGrid.Columns> <DataGridTextColumn Header="编号" Binding="{Binding ID}"></DataGridTextColumn> <DataGridTextColumn Header="公司" Binding="{Binding CompanyName}"></DataGridTextColumn> <DataGridTextColumn Header="固定资产" Binding="{Binding FixedAssets}" Width ="*"></DataGridTextColumn> </DataGrid.Columns> </DataGrid>

(WPF) DataGrid之绑定

喜你入骨 提交于 2020-03-04 21:48:28
通过ObservableCollection 绑定到 DataGrid. 1. 前台Xaml. <DataGrid x:Name="dgMeasurements" HorizontalAlignment="Left" Margin="10,69,0,10" ItemsSource="{Binding}" AutoGenerateColumns="False" Width="370"> <DataGrid.Columns> <DataGridTextColumn Header="Name" Width="90" Binding="{Binding Name}" /> <DataGridTextColumn Header="Unit" Width="40" Binding="{Binding Unit}" /> <DataGridTextColumn Header="Value" Width="80" Binding="{Binding Value}" /> <DataGridTextColumn Header="LowerLimit" Width="80" Binding="{Binding LowerLimit}" /> <DataGridTextColumn Header="UpperLimit" Width="80" Binding="{Binding UpperLimit}"

easyui datagrid 发送两次请求

本秂侑毒 提交于 2020-03-04 21:25:28
easyui datagrid 发送两次请求 场景: 初始化表格时不加载数据,在事件触发时加载表格数据,代码如下: // 初始化表格 dg = $ ( '#dg' ) . datagrid ( { url : '' , // 初始化表格时不加载数据 fit : true , fitColumns : true , border : false , striped : true , idField : 'id' , pagination : true , rownumbers : true , singleSelect : true , pageNumber : 1 , pageSize : 30 , pageList : [ 20 , 30 , 40 , 50 ] , columns : [ [ -- 此处省略 -- ] ] , enableHeaderClickMenu : true , enableHeaderContextMenu : true , enableRowContextMenu : false } ) ; // 查询 function query ( ) { var url = "www.baidu.com" ; // 查询地址 var obj = { } ; // 查询参数 dg . datagrid ( { url : url , queryParams :

easyui datagrid 工具栏实现方式

核能气质少年 提交于 2020-03-03 14:36:17
在使用datagrid时,工具栏有时需要动态控制或添加一些自定义的内容进去,这里把用到的总结一下。 第一种:先定义,后追加 前四个按钮使用datagrid的属性方式添加: toolbar: [ { text: '增加', iconCls: 'icon-add', handler: function () { deviceInfoAddClick(); } }, { text: '修改', iconCls: 'icon-edit', handler: function () { deviceInfoEditClick(); } }, { text: '删除', iconCls: 'icon-remove', handler: function () { deviceInfoDeleteClick(); } }, { text: '查看', handler: function () { } }, '-', { text: '刷新', iconCls: 'icon-reload', handler: function () { deviceInfoRefreshClick(); } }, { text: '导出', iconCls: 'icon-save', handler: function () { $(dg).treegrid('reload'); } }, '-'],

easyui datagrid 分页

老子叫甜甜 提交于 2020-03-03 14:05:29
因为项目需要用到easyui进行显示数据,,涉及到了分页,一直弄不出来,查看网上的极多文章都是同一个版本的java,代码很多。后来无意中看到一些特殊的字眼,page,rows。后来试了结果令人兴奋啊。其实很简单,但对于我刚接触感觉有点困难。 我是用.net mvc来实现的。代码如下: easyui代码: $("#diaryBackground").datagrid({ title: '日记背景列表', iconCls: 'icon-grid', url: '/DiaryBackManage/GetDiaryBackground?c=' + new Date(), striped: true, fitColumns: true, striped: true, pageNumber: 1, pageSize:10, fit: true, singleSelect: true, rownumbers: true, columns: [], }); MVC: public ActionResult GetDiaryBackground() { int pageSize = Convert.ToInt32(Request["rows"]);//通过这个获取得到pageSize int pageNum = Convert.ToInt32(Request["page"]);/

easyui datagrid数据编辑

我的梦境 提交于 2020-02-29 08:53:49
以下为官方数据,不需要其他文件即可实现编辑数据 <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Row Editing in DataGrid - jQuery EasyUI Demo</title> <link rel="stylesheet" type="text/css" href="../../themes/default/easyui.css"> <link rel="stylesheet" type="text/css" href="../../themes/icon.css"> <link rel="stylesheet" type="text/css" href="../demo.css"> <script type="text/javascript" src="../../jquery.min.js"></script> <script type="text/javascript" src="../../jquery.easyui.min.js"></script> </head> <body> <h2>Row Editing in DataGrid</h2> <p>Click the row to start editing.</p> <div style="margin:20px 0;">

Scroll wpf textblock to end

浪子不回头ぞ 提交于 2020-02-28 07:30:58
问题 Is there any feature of the TextBlock that allows scrolling to the end always? I've seen a number of examples that do this in the code behind , I want to keep the principle of MVVM and not touch the code behind, I'm looking for a way to do this in XAML . Have one? 回答1: I am assuming your TextBlock is nested within a ScrollViewer . In this case you are going to have to create an attached property. See this related question: How to scroll to the bottom of a ScrollViewer automatically with Xaml

WPF DataGrid flickering issue

99封情书 提交于 2020-02-22 04:07:49
问题 In WPF, I have a DataGrid bound to a DataView in the ViewModel class. It is a touch panel embedded project, so every time I touch and slide my fingers on the panel it keeps sending me values and saves those values to the DataTable and assigns it to the bound DataView in a way where it can show only 5 or 10 rows (predefined) as the data gets updated. Every time I get a new row I delete the last until the total DataTable row count is 5/10. The issue here is that it is taking longer than usual

WPF DataGrid flickering issue

◇◆丶佛笑我妖孽 提交于 2020-02-22 04:07:15
问题 In WPF, I have a DataGrid bound to a DataView in the ViewModel class. It is a touch panel embedded project, so every time I touch and slide my fingers on the panel it keeps sending me values and saves those values to the DataTable and assigns it to the bound DataView in a way where it can show only 5 or 10 rows (predefined) as the data gets updated. Every time I get a new row I delete the last until the total DataTable row count is 5/10. The issue here is that it is taking longer than usual