开发者

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+"/"+Pict开发者_Go百科ure}"> ?


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'.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜