我的控件的IsEnabled属性在xaml中没有绑定

时间:2011-03-30 05:33:19

标签: silverlight

我的依赖属性没有绑定在控件中。

  public bool EnableMe
            {
                get { return (bool)GetValue(EnableMeProperty); }
                set { SetValue(EnableMeProperty, value); }
            }

            public static readonly DependencyProperty EnableMeProperty =
                DependencyProperty.Register("EnableMe", typeof(bool), typeof(OwnwrClasss), new PropertyMetadata(null));



<Button IsEnabled="{Binding Source=EnableMe}" >
    <Image Source="/Images/icon.png" x:Name="btnShow"/>
<Button>    

我想动态启用和禁用此按钮。

1 个答案:

答案 0 :(得分:0)

解决, 在设置该页面的DataContext之后。

相关问题