WPF Update Binding when Bound directly to DataContext w/ Converter

后端 未结 3 459
别那么骄傲
别那么骄傲 2020-12-31 18:45

Normally when you want a databound control to \'update,\' you use the \"PropertyChanged\" event to signal to the interface that the data has changed behind the scenes.

3条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-31 19:15

    The workaround here was to add a property to my object (to be used as the datacontext) called "Self" , which simply returned

    public Object Self { get { return this; }}

    Then in the binding I used this property:

    Then when I call

    PropertyChanged(this, new PropertyChangedEventArgs("Self"))

    it works like a charm.

    Thanks all.

提交回复
热议问题