我通过以下代码将列添加到DataGrid:
INSERT INTO table (id, actions, date, comments, type, url, rating)
SELECT * FROM (SELECT 'b7d54d99bf11' as id,
'Information Exchanged' as actions,
'1430463600' as date,
'' as comments,
'routine' as type,
'http://example.com' as url,
'' as rating) AS tmp
我绑定的数据是从数据库中检索的DataTable。 DataTable中的值在数据库中是money类型,因此当在DataGrid中显示时,值将类似于1000.0000。
为了删除小数位而设置的StringFormat是什么,因为 StringFormat =" {0:n2}" 不起作用。
答案 0 :(得分:0)
使用此:
Binding = new Binding("n") { StringFormat = "{0,1:F4}" } });