DataGrid WPF VS2010教程 [英] DataGrid WPF VS2010 tutorial

查看:84
本文介绍了DataGrid WPF VS2010教程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好

我正在使用Visual Studio 2010 Express。

我有一个C#WPF应用程序,我有一个DataGrid,我已设法绑定到MySQL数据库 - 那个部分很简单!

从Code Behind,我现在希望操纵网格的某些行和列,具体取决于单元格的内容。如何做到这一点?

我已经找到了几个关于如何使用DataGrid的教程,但看起来它们适用于VS2008,VS2010如何使用DataGrid也发生了重大变化,所以很多功能都不同了,我现在就找出如何操作DataGrid。

你知道任何可以帮助我的VS2010教程吗?

是DataGrid在WPF中对数据库进行查看的最佳方法 - 是否有替代方案?

我是否需要使用WPF工具包为我提供不同的网格控件,可以轻松操作?如果是这样,哪个是免费的廉价工具包呢?



提前感谢任何建议 - 期待一些提示!



Mike

Hi All
I am using Visual Studio 2010 Express.
I have a C# WPF appication where I have a DataGrid that I have managed to bind to a MySQL database - that part was easy!
From Code Behind, I now wish to manipulate certain rows and columns of the grid, depending on the content of cells. How can this be done?
I have found several tutorials on how to use a DataGrid, but it looks like they are for VS2008, and there have been major changes in how VS2010 uses a DataGrid, and so a lot of the functionaility is different, and I carnt find out how to manipulate a DataGrid now.
Do you know of any VS2010 tutorials that can help me?
Is DataGrid the best way to ''look'' at a database in WPF - are there alternatives?
Do I need to use a WPF toolkit to provide me with a different grid control, that can be easily manipulated? If so, which is the best free \ cheap toolkit to do this?

Thanks in advance for any advice - look forward to some tips!

Mike

推荐答案

试试这个 http ://wpftutorial.net/DataGrid.html [ ^ ]

这是一个来自微软的演练 http: //msdn.microsoft.com/en-us/library/ee340709(v=vs.100).aspx [ ^ ](确保在顶部选择.NET Framework 4或使用其他版本下拉选择它)



我发现datagrid / datagridview非常方便查看数据库数据,但这实际上取决于你想用这些数据做什么 - 对于为例你可以将数据转换为XML并在webbrowser中查看它,或者如上面的KM Perumal建议的那样,使用ListView控件。



VS附带的控件应该足以满足您的需求 - 换句话说,我不担心购买/下载其他工具包。很多人使用Telerik扩展,如果你决定走这条路,但我听说你可能在VS2010 Express版本上有一些问题 - 我不确定个人经验是多么真实。我建议你尽量使用标准组件尽可能地舒服。
Try this http://wpftutorial.net/DataGrid.html[^]
And here is a walkthrough from microsoft http://msdn.microsoft.com/en-us/library/ee340709(v=vs.100).aspx[^] (make sure you have ".NET Framework 4" selected at the top or use "Other versions" dropdown to select it)

I find datagrid/datagridview very convenient for "looking" at database data but it really depends on what you want to do with that data - for example you could convert the data to XML and view it in a webbrowser or, as KM Perumal suggests above, use a ListView control.

The controls that come with VS should be sufficient for your needs - in other words I wouldn''t worry about buying / downloading other toolkits just yet. A lot of people use Telerik extensions if you do decide to go down that path, but I''ve heard you may have some issues with VS2010 Express version - I''m not sure how true that is from personal experience. I would recommend that you try to get as comfortable as possible using the "standard" components first though.


AAAGGGHHHHH

我发现我犯了一个错误!我并没有尝试改变daatGrid的属性,而是改变了我放置DataGrid的Grid,因此我为什么要挣扎。初学者的错误。

感谢您的时间 - 抱歉浪费了!

Mike
AAAGGGHHHHH
I have found I was making a mistake! I was not trying to alter the properties of the daatGrid, but alter the Grid that I had place the DataGrid in, hence why I was struggling. Beginner mistake.
Thanks for your time though - sorry for wasting it!
Mike


这篇关于DataGrid WPF VS2010教程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆