Category Archives: WPF

The best tools for software development

Here is a list of tools I you when developing software and for the reason I use that tool. Of course there are many other tools that do similar things and that are preferred by other people. Try all different tools you find and see which meets your needs best. IDE Since I only develop […]

MVVMlight button in DataTemplate

For a major project I’m currently working on I needed to add a button to the items in a ListPicker. This projects uses MVVMLight as MVVM framework, so I have to use the RelayCommand for the handling of the button clicks. My initial thought was to do it just like any other button: View (XAML): […]

Comments Off on MVVMlight button in DataTemplate  

WPF how to stretch listbox content item

Something I’ve been search for, for quit some times is how to stretch the content of a listbox in WPF. If you add a textbox to a listbox item, the textbox will only take as much space as it needs (to make it more visible I’ve add a border and a backgroundbrush): Of course I’ve […]

Comments Off on WPF how to stretch listbox content item  

Use XAML resource in WPF IValueConverter

If you don’t want to hardcoded styles and colors in you WPF, Silverlight or WP7 project you’ve probably added some styles and predefined colors in the APP.XAML file: <Style TargetType="TextBlock" x:Key="Style1"> <Setter Property="Foreground" Value="Black"/> <Setter Property="FontSize" Value="{StaticResource PhoneFontSizeLarge}"/> <Setter Property="FontFamily" Value="{StaticResource PhoneFontFamilySemiLight}"/> </Style> <Style TargetType="TextBlock" x:Key="Style2"> <Setter Property="Foreground" Value="Red"/> <Setter Property="FontSize" Value="{StaticResource PhoneFontSizeMedium}"/> <Setter Property="FontFamily" Value="{StaticResource […]

Comments Off on Use XAML resource in WPF IValueConverter  

Get brush from hex color in WPF, Silverlight, Windows Phone

For an app I created I needed to create a solidcolorbrush from hex RGB string. Seems a simple task, but there is no simple way of doing this. But I’ve created simple method that does just this: public static SolidColorBrush GetBrushFromHexString(string aarrggbb) { string xamlString = "<Canvas xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\" Background=\"" + aarrggbb + "\"/>"; Canvas c […]

Comments Off on Get brush from hex color in WPF, Silverlight, Windows Phone