我有一个窗口,我想将其显示在现有内容的左侧,并且正在使用元素绑定(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/