QbColorViz
If you do not use Visual Studio’s WPF designer, you have probably encountered the scenario where you are trying to decide on a color but since you do not have all of the colors visually memorized, you had to go and look up what the colors are online. Several months ago I wrote an extremely small application that just takes the entire list of colors and displays them in an ItemsControl. That way all it takes is a single click of the app from the Quick Launch bar and all the colors are on display. To make it a little more interesting, it was done entirely in XAML.
This is what the app looks like:
And this is all of the code:
<Window x:Class=”QbColorViz.Window1″
xmlns=”http://schemas.microsoft.com/winfx/2006/xaml/presentation”
xmlns:x=”http://schemas.microsoft.com/winfx/2006/xaml”
Loaded=”Window1_Loaded”
Title=”QbColorViz” Height=”480″ Width=”480″>
<Grid>
<ScrollViewer>
<ItemsControl x:Name=”ColorItemsControl”>
<ItemsControl.ItemTemplate>
<DataTemplate>
<TextBlock FontSize=”16″ Background=”{Binding Path=Name}” Text=”{Binding Path=Name}”/>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</ScrollViewer>
</Grid>
<x:Code>
<![CDATA[
void Window1_Loaded(object sender, RoutedEventArgs e)
{
this.ColorItemsControl.ItemsSource = typeof(Colors).GetProperties();
}
]]>
</x:Code>
</Window>
As you can see, the sneaky part is using a <x:Code> block to eliminate the need to go into the code behind file. I do not recommend using this technique unless you are writing blog entry on how to visualize colors.
For your convenience, here is the application zipped up: QbColorViz
A short time after I wrote the app I saw someone else had done a similar thing: Jobi Joy