Archives / 2009 / September
  • Custom Caret “cheat” in WPF TextBox

    I’ve seen people ask for custom Carets in the WPF TextBox, like in insert mode and you want to have a block caret or underscore. Some say it’s going to be possible/easier to do this in .NET 4.0, but until then, there are some simple cheats you can do to add it yourself, but it will need some tweaking. In this test I’ve put a Canvas on top of the TextBox, on which I draw the custom caret and move it when keys are pressed in the TextBox. If you absolutely need this behavior you can probably tweak it to work, but movement, drawing and all that depends on the font face and size.


    In my sample code, the custom caret is invisible to start with, and only drawn when in overwrite mode. The drawing is kind of jerky when using the arrow keys and home, end etc, but I think it can be fixed. One way would be to make the built in caret the same color as the TextBox background, like described by Lester in his blog post.

  • SQL Azure Explorer Addin for VS2010 Beta 1

    Me and Dag König just released the alpha version of a (so far) small Codeplex project we’ve been working on for the last week or so – an SQL Azure Explorer Addin for Visual Studio 2010 Beta 1.

    The reasons for this project are several, but mostly to learn more about VS2010, how to create addins for it, dig into SQL Azure and at the same time learn some WPF and XAML.

    The addin is a VSIX package and easily installed in VS2010 by just downloading and double clicking it.

    Here’s a sample screenshot of the explorer and the integrated SQL Editor:

    SQL Azure Explorer Addin

    If you got VS2010 Beta 1 and some SQL Azure databases you work with, please download and feedback. I’m sure Microsoft will eventually support SQL Azure in the built-in server explorer, but as I said, this is for fun (it’s great fun to code addins) and the code might be useful for other future projects :)

  • Visual Studio 2008 Web Test Not Recording on 64-bit Windows 7

    vs I was about to record a web test in Visual Studio 2008 Team System today, and the recorder refused to record anything. And the Recorder “bar” in IE 8 was not showing. After some digging around, the issue was fixed by deleting a few registry keys. Found it on Michael Taute's Blog : Diagnosing and fixing Web Test recorder bar issues.

    Quote from his blog page:

    Vista caches the list of explorer bars you have available and the recorder bar was not included in your list. The fix is to force Windows to rebuild that cache. To do this, first make sure you have all Internet Explorer instances shut down, then open the 32 bit registry editor and delete the following keys:

    HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Discardable\PostSetup\Component Categories\{00021493-0000-0000-C000-000000000046}
    HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Discardable\PostSetup\Component Categories\{00021494-0000-0000-C000-000000000046}

    [Note: by default, the 32 bit registry editor is located in %WINDIR%\SysWow64\RegEdt32.exe]

    The next time you boot Internet Explorer, your explorer bar cache will be rebuilt and the recorder bar should be available.