Sometimes you would like to use a standard Windows system icon, such as error, warning, question etc. in your WPF program. The main reason is usually consistent look with the rest of the system. While you could have extracted the desired icon from one of the system resource files, there is a much better technique for doing it. First, add a reference to System.Drawing to your project. Then you can use this sample code to get the desired icon quickly:
WPF allows you to create localized applications with relatively little effort. The localized strings are put into resource files (.resx), one per target language, and maintained as needed. The editing facilities of Visual Studio, however, are not designed to help the localization efforts, however. The GUI can only show one resource file at a time.
Apparently, Microsoft allows users of Visual Studio to include some icons, supplied with the product. For example, to look at available icons in Visual Studio 2010, locate the file
VS2010ImageLibrary.zip in the installation directory of your copy of VS (i.e.
C:\Program Files\Microsoft Visual Studio 10.0\Common7\VS2010ImageLibrary\1033) and extract the .png files you need. You can extract the necessary sub-images from them.
I was quite eager to learn about Windows Phone 7 when the development preview came out. I downloaded the tools and tried to build a sample to get a feel. I must admit that developing .NET application for the new OS is quite easy. However one bit I couldn't make work - localization. With today's global markets and multi-language consumers it is important to be able to deliver your product in different languages. I suspect there was a bug in the version of software I was dealing with then.
The recently released Microsoft Visual Studio 2010 does not support mobile development for OS versions prior to the new Windows Phone 7. If you want to write software for Windows Mobile 6.5 or lower, you need to stick to Visual Studio 2005. So much for backward compatibility.
WPF is a very powerful framework for GUI development. Among other things, it contains a unified approach to user input validation. Adding validation in WPF is very straightforward in most cases. However, validating DataGrid rows is slightly challenging. However, the good people of the world has already taken care of the problem and provided quite detailed walk-throughs. I recommend reading this interesting article (WPF DataGrid Practical Examples) about WPF DataGrid.
WPF is still relatively new and many developers are only scratching the surface of its abilities. Coming from a different framework, one must learn anew how to do the familiar tasks. Sometimes you need to to trigger a click or some other event for one of your WPF controls, such as a button, a menu or a checkbox, directly from code. There are no methods on the controls to invoke these events explicitly.
This is most certainly not the recommended way of implementing QuickSort, it assumes there are no duplicates, but it should work:
private IList<int> sort(IList<int> a)
if (a.Count <= 1)
Serialization in .NET world is not straightforward. For years we've been told to use
XmlSerializer, but it has its limitations. It is unable to serialize anything but the public properties/fields, it cannot deal with interfaces in most of the circumstances (specific collection interfaces being the only notable exception) etc.
I have never suspected that Microsoft had this built-in, but it appears to be the case. Code generator called T4, which targets both C# or VB.NET, is built into your copy of Visual Studio and is available as you read this article. Basically, all you need is to add a new file to your solution with the extension
.tt, and that's it, besides from actually writing the code for the template.