Telerik blogs
  • Desktop WPF

    WPF Line Drawing and the Device-Pixel-(In)dependence

    As you are probably aware resolution and device independence is one of the fundamental design goals of WPF. In order to achieve the desired effect the framework does not work directly with physical (device-dependent) pixels but abstracts this notion into device-independent measuring units like inches. There are two main benefits that you get from this: Automatic DPI-aware scaling Sub-pixel positioning -- WPF coordinates use floating point numbers that theoretically give you the ability to draw with higher precision than the one provided by the ordinary pixel grid. However, there is one nasty side-effect related to the fact that WPF graphics are anti-aliased by default...
    May 27, 2021 3 min read
  • Desktop WPF

    WPF Series: IFrameworkElement - the missing interface

    If you are familiar with WPF you are aware that the the grand daddy of all controls is FrameworkElement. It is defined in the PresentationFramework.dll assembly and derives from UIElement (defined in PresentationCore.dll). Its purpose is to serve as a base element for all framework related stuff: styles, inheritance context, etc. However there is another framework element - FrameworkContentElement. The main distinct between them is that the later did not defines its own rendering behavior (its inheritors should do so). This is way properties like: (Actual)Width or (Actual)Height are not present at FrameworkContentElement. If you examine the classes that derive from FrameworkContentElement...
    May 27, 2021 2 min read
  • Desktop WPF

    WPF Series: Creating Generic Adorner

    As I have mentioned at the end of the previous post today I will show you how to create a generic adorner, which will allow you to decorate a single element  multiple times at different positions. At the end we will be able to create something that looks like this: To achieve this we will need a way to say that we want to position the adorner at the different corners of the element as well as to specify whether we want to be inside or outside (vertically or horizontally) of the element. Let's create some enumeration types that will serve for...
    May 27, 2021 2 min read
  • Web

    Increasing the compression ratio of the XAP files

    Today I was hacking around with a Silverlight application and decided to check if it is possible to recompress its XAP file in order to save some bytes. As you might already know, the XAP files are just renamed ZIP files and you can open and view their contents with almost any archiver. I created a simple batch file that extracts an archive to a temp folder, deletes it and then compresses the extracted files into a new archive with the same name as the original (I am using the open source archiver 7-Zip, which was installed in its default location): @if...
    May 27, 2021 2 min read
  • Web

    History Enabled Script Manager and Silverlight

    A.k.a Deep Linking in Silverlight Undoubtedly Silverlight offers a myriad of useful features that can enhance the user and development experience – Binding, Multithreading, Layout System, Animations to name a few. But the fact that it is in essence a browser plug-in leads to certain limitations or “hurdles” for the user experience. Deep Linking? Why? One such thing is the lack of Deep Linking, i.e. the browser’s address bar contains the starting page for the application but any change in its state is not reflected in the address. Some people argue that there is difference between Web Applications and Web Pages and while the...
    May 27, 2021 5 min read