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!


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



That should do the trick :)

by xamlgeek

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: