c# - Silverlight 元素绑定(bind)不起作用

标签 c# wpf silverlight xaml binding

我有一个窗口,我想将其显示在现有内容的左侧,并且正在使用元素绑定(bind)来执行此操作。这在 WPF 中工作得很好,但在 Silverlight 中,窗口只是转到 Canvas 控件的最右侧,我不知道为什么?

<Grid x:Name="rightPanelGrid" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="10,10,10,0">

<!-- Other xaml -->

<local:mywindow IToolkit:CanvasControl.Right="{Binding ElementName=rightPanelGrid, Path=ActualWidth}"

最佳答案

Silverlight 确实 not support像这样绑定(bind)到 ActualWidth :(

For purposes of ElementName binding, ActualWidth does not post updates when it changes (due to its asynchronous and run-time calculated nature). Do not attempt to use ActualWidth as a binding source for an ElementName binding. If you have a scenario that requires updates based on ActualWidth, use a SizeChanged handler.

关于c# - Silverlight 元素绑定(bind)不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17491483/

相关文章:

c# - 从 PropertyGrid 显示详细的文件夹浏览器

c# - 使用 C# 使用 REST API

c# - 成功链接帐户后,Google 操作不提供 user.profile.payload 对象

javascript - 如何访问javascript函数asp.net中的列表对象

c# - 在 Silverlight c# 中搜索名称识别

c# - 如何转到 IEnumerable 中的特定项目

c# - Wpf 将自定义类与列表绑定(bind)到 ListBox

c# - WPF 数据网格在 c# 中与远程/在线 mysql 绑定(bind)

wpf - 编辑枚举属性 (WPF) 时 Visual Studio 崩溃

silverlight - MVVM Light、Windows Phone、View & ViewModel 在页面之间导航