我有一个绑定(bind)值,该值返回一个int,该int表示我没有分配给元素左右边界的值。
这是我尝试过的内容,但无法编译。
如果我设置整个边距,它会起作用,但是我只想左右移动。
Xml:
<Image x:Name="_image" Source="mat.png" Margin="{Binding EditorRow.BondIndent},0,{Binding EditorRow.BondIndent},0" />
类:
public int BondIndent
{
get { return _bondSequence * 5; }
}
最佳答案
退还 margin ?
public Thickness Margin
{
get { return new Thickness(BondIndent,0,BondIndent,0);}
}
然后更改:
<Image x:Name="_image" Source="mat.png" Margin="{Binding EditorRow.Margin}" />
关于c# - 从绑定(bind)设置边距,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/14360381/