wpf - 不绑定(bind)图像源的值转换器

标签 wpf image binding converter

我需要通过值转换器获取图像的路径。但是,我找不到任何使用不绑定(bind)值转换器的示例。

我希望按照这些思路做一些事情:

<Image source="{Value=Image1, Converter={ImageConverter}}" />

然后图像转换器将检查图像文件夹并返回正确的文件路径。

最佳答案

为什么不像这样使用Binding:

<Image Source="{Binding ., Converter={StaticResource ImageConverter}, ConverterParameter=Image1}"/>

这还不够吗?

关于wpf - 不绑定(bind)图像源的值转换器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1333931/

相关文章:

c# - 来自其他对象的 wpf 命令参数

c# - Parallel.ForEach如何处理取消或ThrowIfCancellationRequested()和异常

wpf - 如何在 xaml 中对公共(public)属性进行数据绑定(bind)

java - 使用哪个图像

image - css - 容器 div 使内容适合图像

c# - 使用代码隐藏将 WPF TreeView 中节点中的父字体设置为粗体

c# - WPF (Avalonia) 可重用上下文菜单样式

c# - 在 Windows Phone 8.1 中从字节数组(数据库)加载、显示、转换图像

html - 绑定(bind)到 GWT 中的 HTML 元素

c# - 将 SolidColorBrush 绑定(bind)到 ControlTemplate 背景