1

I have lots of icons in black & white color. My goal is to make a converter that receives those icons and blend the icon bitmap with another color, specified as a converter parameter. For example:

<Window Icon="{Binding Path=MyBlackAndWhiteIcon,
                       Converter={StaticResource myColorConverter},
                       ConverterParameter=FFCC00"/>

Can someone give me a clue on how do I properly build this converter?

PS: I knwo how to make converters. The question is about this specific converter, since "MyBlackAndWhiteIcon" is typically a string pointing to an resource image.

TapiocaCom
  • 353
  • 5
  • 16

1 Answers1

1

First, put this at the top of your page: using Windows.UI.Xaml.Data;. You need this for the IValueConverter class.

Next, read these webpages about converters:

http://wpftutorial.net/ValueConverters.html
http://tech.pro/tutorial/806/wpf-tutorial-binding-converters

These pages are what taught me how to create my converters.

Here is a sample converter:

using Windows.UI.Xaml.Data;

public class FromobjectToToobjectConverter : IValueConverter
{
    public object Convert(object value, Type targetType, object parameter, string language)
    {
        // Converting code here
    }

    public object ConvertBack(object value, Type targetType, object parameter, string language)
    {
        // Convert back here
        throw new NotImplementedException();
    }
}