WPF控件绑定宽度 [英] wpf control width binding

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

问题描述

我有两个边框与内容,第二个边界的变化取决于宽
上的内容,我想第一个边界到第二边​​框的宽度,但绑定
它不工作,我不知道什么我失踪。有人可以给我一些指导吗?
下面是什么,我目前正试图一个例子。

 < BORDER X:NAME =border1WIDTH ={绑定路径=宽度,的ElementName = border2}>
    ...
< /边框>< BORDER X:NAME =border2>
    ...
< /边框>


解决方案

将路径更改为 ActualWidth的

I have two borders with content, The second border width changes depending on the content, I'm trying to bind the first border to the second border width but it's not working and I'm not sure what i'm missing. Can someone give me some direction please? Below is a example of what I'm currently trying.

<Border x:Name="border1" Width="{Binding Path=Width, ElementName=border2}">
    ... 
</Border>

<Border x:Name="border2">
    ...
</Border>

解决方案

Change the path to ActualWidth.

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

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