【发布时间】:2011-03-23 12:36:28
【问题描述】:
所以,假设我在 C# 和 Ruby 中有两个几乎相同的类:
C#
public class Test
{
public Test()
{
ImageLocation = "http://www.ironruby.net/@api/deki/site/logo.png";
}
public string ImageLocation { get; set; }
}
红宝石
class Test
attr_accessor :ImageLocation
def initialize
@ImageLocation = "http://www.ironruby.net/@api/deki/site/logo.png"
end
end
当我在 C# 中绑定到“ImageLocation”属性时,所有三个控件都正确绑定。当我使用 IronRuby 对象绑定到同一个属性时,它适用于 TextBlock,但对于 TextBox 和 Image 无效。这是我的 XAML:
<Image Source="{Binding ImageLocation}" Width="50" />
<TextBlock Text="{Binding ImageLocation}" />
<TextBox Text="{Binding ImageLocation}" />
为什么绑定对一个控件有效,而对其他控件无效?
【问题讨论】:
标签: wpf data-binding binding ironruby