设置绑定的边距 [英] Set a margin from a binding

查看:32
本文介绍了设置绑定的边距的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个绑定值,它返回一个 int 值,该值表示我没有分配给元素的左右边距的值.

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.

XML:

<Image x:Name="_image" Source="mat.png" Margin="{Binding EditorRow.BondIndent},0,{Binding EditorRow.BondIndent},0" />

类:

public int BondIndent
{
    get { return _bondSequence * 5; }
}

推荐答案

退保证金?

public Thickness Margin
{
    get { return new Thickness(BondIndent,0,BondIndent,0);}
}

然后改变:

<Image x:Name="_image" Source="mat.png" Margin="{Binding EditorRow.Margin}" />

这篇关于设置绑定的边距的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆