<UserControl xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
         xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
         xmlns:local="clr-namespace:son"
         x:Class="son.SonWindow">
    <Grid x:Name="myGrid">
        <Grid.Tag>
            <Label Content="{Binding ActualWidth, ElementName=myGrid}" />
        </Grid.Tag>
    </Grid>
</UserControl>
Run Code Online (Sandbox Code Playgroud)
就像上面的一个简单代码一样,但是绑定找不到Element myGrid.在运行时,错误显示在"输出"窗口中
"System.Windows.Data错误:4:无法找到与引用'ElementName = myGrid'绑定的源.BindingExpression:Path = ActualWidth; DataItem = null;目标元素是'Label'(Name =''); target属性是'内容'(类型'对象')"
我正在使用Visual Studio 2015社区版与.Net Framework 4.5.2.有任何想法吗?先感谢您.