我有一个带DependecyProperty的UserControl:
git symbolic-ref --short HEAD 2> /dev/null || git rev-parse HEAD
在Xaml中:
public static readonly DependencyProperty OpenCommandProperty =
DependencyProperty.Register(
"OpenCommand",
typeof(ICommand),
typeof(BaseRouteFlatView),
new UIPropertyMetadata(null));
public ICommand OpenCommand
{
get { return (ICommand)GetValue(OpenCommandProperty); }
set { SetValue(OpenCommandProperty, value); }
}
我必须在第二个按钮中为工作命令指定什么来源?
答案 0 :(得分:1)
尝试以下方法:
public UserControl()
{
InitializeComponent();
NameScope.SetNameScope(second, NameScope.GetNameScope(this));
}