Implementing INotifyPropertyChanged

แชร์
ฝัง
  • เผยแพร่เมื่อ 4 ก.พ. 2025

ความคิดเห็น • 8

  • @trustingod0
    @trustingod0 ปีที่แล้ว

    Great Video Learned a lot. helped to tie up some loose ends.

  • @juliorockdriguez
    @juliorockdriguez 2 ปีที่แล้ว +2

    Hi Nathan. Your example works, but I don't understand why. Where some method suscribes to the event PropertyChanged? Where this assignation happens: PropertyChanged+= SomeMethod; ? Thanks

    • @casperdjensen
      @casperdjensen ปีที่แล้ว +1

      The UI subscribes to the PropertyChanged event in the data binding mechanism, made possible because the class implements INotifyPropertyChanged, which is a standard .NET interface to notify clients, typically binding clients (e.g., UI controls in WPF), that a property value has changed.. This happens in the XAML file with something like this:

  • @eddy1537
    @eddy1537 ปีที่แล้ว

    So if Size property is changed and the event is triggered what happens? How could you possibly spend 21 min and not include how to intercept and act on the preperty change? BLOWS MY MIND

  • @ElCidPhysics90
    @ElCidPhysics90 ปีที่แล้ว

    You made the private backing fields public.

  • @philsnewaddress
    @philsnewaddress ปีที่แล้ว

    Lots of these youtube tutorials on INotifyPropertyChanged have people asking the same question - where is PropertyChanged event implemented so that it isn't null. I suspect that the framework has implemented the event for each item that is bound to that other property. You don't see it here. You are firing an event into the binding structures at runtime. Probably the best question to ask is - what other properties do I want to update as a consequence of this property being set. If binding has been set on that property, there will be an event handler behind the smoke and mirrors.

  • @RT-fi7rb
    @RT-fi7rb ปีที่แล้ว

    Why do we need to implement the interface INotifyChanged, when we want to use the event property changed? Normally a interface have no code, it is just a shape for classes …

  • @dannyhunn6025
    @dannyhunn6025 2 ปีที่แล้ว

    Thank you