Tag Archives: Bug

ImageBrush Can’t Be Data Bound

26 Feb

If you have a Border (or another Control) and wish to set the background dynamically using an ImageBrush and wish to use databinding to set the ImageSource, you will get a runtime error.

You cannot use databing to set the ImageSource on an ImageBrush!

image

To work around this issue you can bind the background on the border instead and use a ValueConverter to generate the ImageBrush dynamically.

image

image

That should do the trick :)

by xamlgeek