How to multiply a value by a constant in WinRT XAML

The easiest way to accomplish this task is to use converter provided below. It is written in C++ but this convertor can be easily converted to C#:

public ref class MultiplicationConverter sealed : Windows::UI::Xaml::Data::IValueConverter

    virtual Platform::Object^ Convert(Platform::Object^ value, Windows::UI::Xaml::Interop::TypeName targetType, Platform::Object^ parameter, Platform::String^ language);

    virtual Platform::Object^ ConvertBack(Platform::Object^ value, Windows::UI::Xaml::Interop::TypeName targetType, Platform::Object^ parameter, Platform::String^ language);


    Platform::Object^ InternalConvert(Platform::Object^ value, Platform::Object^ parameter, bool forward);


Dynamic splitter control for Universal Windows App (UWP)

I developed some prototype of a custom layout panel on Universal Windows Platform called DynamicSplitter that contains multiple child panes and arranges them horizontally or vertically depending on its IsHorizontal property of type bool. To support heterogeneous layout of panes, DynamicSplitter itself is used as the child pane of another DynamicSplitter with different IsHorizontal property. So, for example, the parent splitter can have two panes split horizontally one of which is a user control and other is the child splitter, and the child splitter can have three panes split vertically and so on.

Regardless of DynamicSplitter has a lot in common with Grid or StackPanel it is inherited directly from Panel and lays out its child panes by overriding MeasureOverride(…) and ArrangeOverride(…) functions:


How to open a project from Git repository in MS Visual Studio 2013

Below I provided the key steps for opening a project in MS Visual Studio 2013 from a Git repository.

First, go to TOOLS->Options->Source Control and select Microsoft Git Provider:

Microsoft Git Provider


Implementation of WPF’s ICollectionView interface

The existing ICollectionView implementations in WPF, for example ListCollectionView, work very good in trivial cases, they even can sort and filter the items from the underlying collection, but they have some significant disadvantage: they do not keep the correct sort order of an item and they do not filter the item out if its property is changed until ICollectionView.Refresh() method is called explicitly.

To overcome this inconvenience I developed my own implementation of ICollectionView interface that listens to all its items property change events via WeakEventManager and fires corresponding collection change events to re-soft or re-filter the item if needed. It was not a very simple task for me, and I even debugged WPF source code a bit and realized that it works a bit strange, for example, ItemsControl cannot work with my ICollectionView implementation directly, instead it creates some CollectionViewProxy that wraps it and uses some proxy enumerator to access an item by index:


Debugging .NET Framework with Visual Studio 2013

Visual Studio 2013 allows easily to debug .NET 4.5.1 Framework source code. If you use a previous version of .NET (4.5 or earlier) change the target .NET version of the your projects to 4.5.1 or higher. If you have some C++ CLI projects modify TargetFrameworkVersion attribute manually in all *.vcxproj files:

<PropertyGroup Label="Globals">

then go to Tools->Options->Debugging->General and check/uncheck the following options:

Debugging .NET Framework with Visual Studio 2013


Using Visual Leak Detector with MS Visual Studio 2013

Go to Tools->Extensions and Updates, download and install Using Visual Leak Detector:

Using Visual Leak Detector

Create a header file, named, for example, CommonTools.h containing the following:

#pragma once

#include "C:\Program Files (x86)\Visual Leak Detector\include\vld.h" 

#pragma comment(lib, "C:\\Program Files (x86)\\Visual Leak Detector\\lib\\Win32\\vld.lib")

Include CommonTools.h in at least one file in all the C++ projects in your solution. Build debug version of the program. Visual Leak Detector will write the information on memory leaks to Output window when the program exits.

HwndHost is not clipped inside ScrollViewer

I created a simple white control with a black border derived from HwndHost (named LightGrid) and added it to ScrollViewer along with some other controls (replaced with “…”) as shown below:

<ScrollViewer HorizontalScrollBarVisibility="Disabled">
            <ColumnDefinition Width="Auto" />
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
        <Border Grid.Row="6" Grid.ColumnSpan="2" Visibility="Visible" Height="200">
            <nc:LightGrid />

It looks correctly in the lower scroll position, and it even can scroll inside ScrollViewer (it moves when I move the scroll bar), but when scrolled, it is not clipped so it obscures other controls:


How I fixed “error LNK2005: _DllMain@12 already defined in msvcrtd.lib”

Today I got “error LNK2005: _DllMain@12 already defined in msvcrtd.lib” while linking some C++ CLI project with MFC support in MS Visual Studio 2013. As described in A LNK2005 error occurs when the CRT library and MFC libraries are linked in the wrong order in Visual C++A LNK2005 error occurs when the CRT library and MFC libraries are linked in the wrong order in Visual C++ article, I added /verbose:lib linker option:

MS Visual Studio Linker options


Combining XAML and DirectX together in a WinRT application

With the release of Windows 8, Microsoft introduced a grate technology for combining XAML and DirectX together, letting us to place XAML controls over intensive real-time graphics, see DirectX and XAML interop (Windows Runtime apps using DirectX with C++) for more details.

You can easily download and build sample XAML SwapChainPanel DirectX interop sample demonstrating how it works. All that you need is Visual Studio 2013 with installed license. After the license is installed Visual Studio 2013 shows the following dialog:

Visual Studio 2013 license


How to install Java Plug-in for FireFox browser on Windows

Probably it is a trivial question, but the answer is not always obvious. The main rule is to follow the right link like this: As the result you will get:

JavaPlugin for FireFox

To check if it works or not follow this link: