WPF Scrollable + Zoomable + Dragable Control

Unluckily there is no standard control to zoom, drag and scroll your content. My implementation is based on following tutorial. With this implementation you are able to zoom, drag and scroll arbitrary controls. Showcase ScrollDragZoomControl.xaml


Usage Add the “ScrollDragZoomControl” to your project and use it as follows:


Packet structure

The most “complicated” thing with this library is clearly the packet structure. We have to keep some things in mind to guarantee a flawless serialization. We differ between two packet types. The Request and the response packet. Request Packet The request packet is used to “start” a conversation. We literally request something.

We always …

Send/Receive packets

The server can only register each packet type once. Therefore, on serverside we have to use the “RegisterStaticPacketHandler” method. That will map a packettype directly to the given delegate. In the following example we start to listen to a “CalculationRequest” after a connection has been established.

connection.RegisterStaticPacketHandler registers the generic <CalculationRequest> to the delegate …

Send and receive a packet async

Send and receive a packet with a delegate


Send and receive a packet in a lambda


Client Setup

[TCP/UDP] ClientConnectionContainer The ClientConnectionContainer contains a TCP and a UDP connection by default. In addition the ClientConnectionContainer supports: Reconnecting if the TCP and/or the UDP connection has been lost Offering various methods to send data (async, fast, slow) Buffering packets if there is no available connection Remember your settings and packet-configurations after a reconnect

Server Setup

After “StartTCPListener();” the Server is up and running. The TCPListener is also in charge of the UDP connections. The property “AllowUDPConnections” indicates whether the server is going to accept incomming UDP connections.

UWP (WinRT) Get Raw and Real Resolution

Working with resolutions can be a real pain with WinRT apps. The MS framework isn’t as far developed as we wish sometimes. Getting the “real” resolution on a device depends on several factors. Does the device supports software buttons Do we display the titlebar Which scale factor is currently active The orientation of the device DPI All …