Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/clojure/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Wpf 具有依赖项属性的Usercontrol不';我不认识变化_Wpf_Dependency Properties - Fatal编程技术网

Wpf 具有依赖项属性的Usercontrol不';我不认识变化

Wpf 具有依赖项属性的Usercontrol不';我不认识变化,wpf,dependency-properties,Wpf,Dependency Properties,我有一个自定义类,usercontrol在其代码隐藏中作为依赖项属性实现了该类 public partial class HandControl { public HandControl() { InitializeComponent(); } public Seat Seat { get { return (Seat)GetValue(SeatProperty);

我有一个自定义类,usercontrol在其代码隐藏中作为依赖项属性实现了该类

public partial class HandControl
{
    public HandControl()
    {
        InitializeComponent();
    }

    public Seat Seat
    {
        get
        {
            return (Seat)GetValue(SeatProperty);
        }
        set
        {
            SetValue(SeatProperty, value);
        }
    }

    public static readonly DependencyProperty SeatProperty = DependencyProperty.Register("Seat", typeof(Seat), typeof(HandControl), new PropertyMetadata(null));
}
在我的例子中,我将该类中的name属性绑定到usercontrols xaml中的标签

<Label Content="{Binding Seat.Player.Name, RelativeSource={RelativeSource AncestorType={x:Type controls:HandControl}}}"/>

我有什么问题?有人有线索吗?

我想你应该提出关于Seat.Player.Name属性更改的问题,因为它正在被更改。

没错,这是我的问题。我还必须在我的Seat类中实现InotifyProperty更改。
    public Seat SeatTr
    {
        get { return _seatTr; }
        private set
        {
            _seatTr = value;
            OnPropertyChanged();
        }
    }

    <customControls:HandControl Grid.Row="1"
                                Grid.Column="3"
                                Seat="{Binding SeatTr}" />
    private void OnSeatChanged(Player player, SeatPosition seatPosition)
    {
        //... doing the changes ...\\
        OnPropertyChanged("SeatTr");
    }