这是用户控制背后的代码
public delegate void YardSelectionChangedDelegate();
public event YardSelectionChangedDelegate YardSelectionChanged;
public static readonly DependencyProperty SelectedYardIdProperty =
DependencyProperty.Register(
"SelectedYardId",
typeof(long),
typeof(YardSelectorUserControl),
new UIPropertyMetadata(null));
这是属性:
public long SelectedYardId
{
get { return (long)GetValue(SelectedYardIdProperty); }
set { SetValue(SelectedYardIdProperty, value); }
}
这是父窗口中的绑定:
SelectedYardId="{Binding Path=YardId,UpdateSourceTrigger=PropertyChanged}"
问题是该属性的 Set 永远不会起作用,并且光标永远不会到达 Set 主体。确实谢谢。