【发布时间】:2011-01-19 05:49:40
【问题描述】:
是否可以使用价值转换器而不必事先将它们定义为资源?
我现在有
<Window.Resources>
<local:TrivialFormatter x:Key="trivialFormatter" />
</Window.Resources>
和
<Button Width="{Binding Width,
ElementName=textBox1,
UpdateSourceTrigger=PropertyChanged,
Converter={StaticResource trivialFormatter}}">
难道我不必在 Window.Resources 中声明 trivialFormatter 资源,而可以直接从 Button 的宽度绑定中引用它吗?类似的东西
Converter = {local:TrivialFormatter}
谢谢
【问题讨论】:
标签: c# wpf data-binding converters