kaycee
kaycee

Reputation: 1309

bound picture to control in WPF without using converter

i'm having a custom object with Picture as a string (file name only) and i want to display.

the problem is that the image is stored in "images" directory of the project so the full path is now "images/{image name}"

how can i bind it correctly ?

i can do it easily with converter i guess, but is there any way to avoid it like: <Image Source="{Binding Path=FullPath+"/"+Picture}"> ?

Upvotes: 0

Views: 106

Answers (1)

lbergnehr
lbergnehr

Reputation: 1598

You could bind to an aggregated property in your ViewModel and then put whatever path you like into that. That way the ViewModel becomes the 'converter'.

Upvotes: 1

Related Questions