In WPF, Silverlight and Windows Phone it is possible to render a visual object into a bitmap using the RenderTargetBitmap. This functionality, that I find pretty basic, was not available for Windows Store applications. Fortunately, Windows 8.1 provides that functionality for Windows Store applications too, through the same RenderTargetBitmap class. There are some limitations though:…
Tag: .NET
Bindings for DataGridView hosted in an MFC application
A WinForms DataGridView control has the ability to automatically generate its columns and populate from a specified data source (which can be a DataSet, a simple list or something else). All you have to do is something like this: var list = new List<Record>() {new Record() {Id = 1, Name = “item 1”, Date =…
error C3510: cannot locate dependent type library ” {bed7f4ea-1a96-11d2-8f08-00a0c9a6186d} v.2.4
Problem I have recently migrated a C# 2.0 project registered for COM interop to .NET 4.5 and when I imported the type library in a C++ project with no_registry, suddenly I got some errors because the type library could not be imported. Here are the steps to reproduce: create a .NET Class Library project and…
Why won’t my .NET redistributable assemblies show up in Visual Studio’s ‘Add Reference’ dialog?
The Problem You install a .NET redistributable package and want to reference the assemblies in your project. However, though everything is correctly installed to GAC, the assemblies don’t show up in Visual Studio’s Add Reference dialog in the .NET tab (regardless of what version of Visual Studio you have). The Cause Redistributable assemblies are intended…
Windows Runtime
Windows Runtime, or shortly WinRT, is a new runtime (siting on top of the Windows kernel) that allows developers to write Metro style applications for Windows 8, using a variety of languages including C/C++, C#, VB.NET or JavaScript/HTML5. Microsoft has started rolling out information about Windows 8 and the new runtime at BUILD. WinRT is…
How To Determine the Platform Architecture for a .NET Assembly
I’m using Red Gate’s .NET Reflector for decompiling .NET assemblies. It’s a great tool but it lacks, at least in the free version I’m using, information about the platform architecture of an assembly. Sometimes I want to know whether an assembly was built for Any CPU, x86 or x64. The tool that help you find…
Interface Implementation in C#
I recently found a piece of code that can be summarized by the following sample: interface I { void F1(); void F2(); } class X { public void F2() { Console.WriteLine(“F2”); } } class A : X, I { public void F1() { Console.WriteLine(“F1”); } } As you can see there is an interface I…
DotNetZip Library
.NET 3.0 provides some support for working with ZIP files. However, it has an important drawback: it only works for packages that are conformant to the Open Packaging Convention standard. Most of the ZIP files are not. Codeplex features a library called DotNetZip that provides support for packing and unpacking in C#, VB.NET or any…
Reference a XAML From Another Project
When you create a WPF application, the start-up window is by default one from the same project (by default called Window1.xaml). < Application x:Class=”WpfApplication1.App” xmlns=”http://schemas.microsoft.com/winfx/2006/xaml/presentation” xmlns:x=”http://schemas.microsoft.com/winfx/2006/xaml” StartupUri=”Window1.xaml” > < Application.Resources > < /Application.Resources > < /Application > But what if you want to use a window from another project (class library)? The pack URI scheme,…
STM.NET
Microsoft has made available a first beta version of an experimental version of .NET 4.0, called .NET Framework 4.0 Beta 1 Enabled for Software Transactional Memory v1.0. Since that is quite a long name, the short one is STM.NET. This is a special version of .NET 4.0 that enables software transactional memory for C#. It…