TypeConverters provide a means of converting a String to the appropriate .NET type or a new instance when XAML is processed. I’ve already looked at how the XAML parser searches for TypeConverters (XAML and TypeConverters ) Now let’s take a look at how to create our custom TypeConverter.
At a minimum, for a class to [...]
Archive for the ‘Programming’ Category
Creating a Custom XAML TypeConverter
Posted in Programming, tagged .NET, C#, Silverlight, XAML on February 3, 2010 | Leave a Comment »
Adding a Custom Silverlight Control
Posted in .NET, Programming, tagged C#, Silverlight, XAML on January 27, 2010 | 4 Comments »
Silverlight has a ton of controls that we can use in our Silverlight apps. Most of the times, this collection of controls is sufficient, but every once in a while, we need to create a custom control. Adding a new custom control for Silverlight is fairly straightforward, and in this blog post I am going [...]
XAML and TypeConverters
Posted in .NET, Programming, tagged .NET, C#, Silverlight, XAML on January 20, 2010 | 2 Comments »
In a XAML document, every element maps to an instance of a Silverlight (.NET) class. The properties of this instance can be set through attributes in the XAML file. There is a bit of a catch though. These attribute values (in the XAML file) are in text form, whereas the corresponding Silverlight property is a [...]
Silverlight – Getting started with XAML
Posted in .NET, Programming, tagged .NET, C#, Silverlight, XAML on January 17, 2010 | Leave a Comment »
XAML stands for eXtensible Application Markup Language (pronounced zamm-uhl). It is an XML based markup language used to instantiate .NET objects. XAML was initially designed as part of Windows Presentation Foundation (WPF), and allows developers to define rich user interfaces. A XAML file defines the elements that make up a content region. This enables a [...]
Visualizing STLPort data structures in Visual Studio Debugger
Posted in Debugging, Programming, tagged Programming, Visual Studio on November 23, 2009 | 2 Comments »
Recently, I had to use STL Port for a particular project. While debugging, I was hampered by the fact that my data structures were not providing as much information in the watch window as I would have hoped. Using std::vector as an example, here’s a screen shot that highlights the problem.
After a bit of investigation [...]
Java Enum Puzzler
Posted in Java, Programming, tagged enum, Java, puzzle on September 29, 2009 | 3 Comments »
Recently, I ran into an interesting bit of code related to Java enumerations. Here’s a contrived minimal sample:
/*
* Some arbitrary resource type
*/
interface Resource {
public Resource getResource();
}
enum A implements Resource{
ALPHA (B.BRAVO);
private Resource res;
private A (Resource res){ this.res = res; }
public Resource getResource(){ return res; }
}
enum B implements Resource{
BRAVO (C.CHARLIE);
private Resource res;
private B (Resource res){ [...]
Pasting source code to wordpress.com using Windows Live Writer
Posted in Programming on September 26, 2009 | Leave a Comment »
Apparently, wordpress.com does not play nicely with pasting source code, especially if you are using the excellent Windows Live Writer and its Code Snippet plugin. I had to google quite a bit before I could figure out the right way to paste source code to my blog using WLW. Thanks to Vadim for his very [...]