<TextBlock x:Name="Block" Foreground="White" FontSize="13">
<SLMultiBinding:BindingUtil.MultiBinding>
<SLMultiBinding:MultiBinding TargetProperty="Text" Converter="{StaticResource ConverterConcat}">
<Binding Path="name"/>
<Binding Path="name"/>
</SLMultiBinding:MultiBinding>
</SLMultiBinding:BindingUtil.MultiBinding>
</TextBlock>
我只能翻译
var binding = new MultiBinding()
{
TargetProperty = "Text",
Converter = new Restaurant.Helpers.Converter.ConcatConverter(),
Bindings = new ObservableCollection<Binding>()
{
new Binding("name"),
new Binding("name")
}
};
最佳答案
您正在寻找如何设置Attached Property。
在您的情况下,它将类似于BindingUtil.SetMultiBinding(Block, binding);
关于c# - 如何将xaml转换为后面的代码?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/6223652/