开发者

WPF Set border left and width

开发者 https://www.devze.com 2023-02-20 01:45 出处:网络
I need to set the left and width of a border.I\'m trying to use margin b.Margin = ne开发者_运维问答w Thickness(pb.X, b.Margin.Top, b.Margin.Right, b.Margin.Bottom);

I need to set the left and width of a border. I'm trying to use margin

b.Margin = ne开发者_运维问答w Thickness(pb.X, b.Margin.Top, b.Margin.Right, b.Margin.Bottom);

but if I set the Width property the border is placed in an incorrect strange position... (the half screen + half of the left that i want).

how can i do the trick?

thanks


var totalAvailableWidth = ...; // you will have to get it somewhere
var marginRight = totalAvailableWidth - pb.X - width;
b.Margin = new Thickness(pb.X, b.Margin.Top, marginRight, b.Margin.Bottom);
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号