从绑定设置保证金 [英] Set a margin from a binding
本文介绍了从绑定设置保证金的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个绑定值,返回一个int值重新presents值我不是分配给左,元素的右页边距。
继承人什么,我已经试过,但它不会编译。
它的工作原理,如果我设置了全缘,但我只想左右。
XAML中:
<图像X:名称=_形象来源=mat.png保证金={结合EditorRow.BondIndent} 0 {结合EditorRow.BondIndent} 0 />
类:
公众诠释BondIndent
{
{返回_bondSequence * 5; }
}
解决方案
返回保证金?
公共厚度保证金
{
{返回新的厚度(BondIndent,0,BondIndent,0);}
}
然后改变:
<图像X:名称=_形象来源=mat.png保证金={结合EditorRow.Margin}/>
I have a binding value that returns a int that represents a value I wasnt to assign to left and right margins of an element.
Heres what I've tried but it wont compile.
It works if I set the entire margin, but I only want left and right.
Xaml:
<Image x:Name="_image" Source="mat.png" Margin="{Binding EditorRow.BondIndent},0,{Binding EditorRow.BondIndent},0" />
class:
public int BondIndent
{
get { return _bondSequence * 5; }
}
解决方案
Return the margin?
public Thickness Margin
{
get { return new Thickness(BondIndent,0,BondIndent,0);}
}
Then change:
<Image x:Name="_image" Source="mat.png" Margin="{Binding EditorRow.Margin}" />
这篇关于从绑定设置保证金的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文