如何在Silverlight中将子元素的宽度绑定到父元素的宽度 [英] how to bind width of child element to width of parent element in silverlight

查看:89
本文介绍了如何在Silverlight中将子元素的宽度绑定到父元素的宽度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个宽度为"1 *"的网格.因此,我认为实际宽度是在运行时决定的. 在该网格中,我有另一个网格,其宽度要设置为父网格的运行时宽度.如何通过绑定在xaml中做到这一点.

I have a grid whose width is "1*". So the actual width decided at runtime I think. Within that grid I have another grid whose width I want to set to the runtime width of parent grid. How Can I do that in xaml through binding.

推荐答案

我猜这实际上将为您提供帮助

This will actually help you I guess

Width="{Binding ActualWidth, ElementName=parentElementName}"

这会将宽度绑定到父元素或提供的元素名称

This binds the width to the parent element or the element name provided

这篇关于如何在Silverlight中将子元素的宽度绑定到父元素的宽度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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