I have a binding without path using a converter. This is because the converter will use many properties of the object to build the text for the tooltip. But when one property changes (INotifyPropertyChanged is implemented and OnPropertyChanged raised), this binding without path does not get updated. I guess because it does not bind to a specific property.
How to tell that it has to update?
I try to be more specific:
The bar object has a 'Start' property. When I change this the bar moves in time because the binding gets directly to the Start property. So the notification works for single properties. But the tooltip binding is {Binding Converter={StaticResource TooltipConverter}}
and does not bind to a specific property. When 'Start' changes, the bar is moved but the tooltip does not update because the tooltipconverter is not called again.
The bar is one object in an ObservableCollection<Bar>
. Should the bar tell the collection or the view model? Normally is would not have any relationship to it.
One possible workaround is:
Give your object a ItSelf property (or other name) like:
public Object ItSelf
{
get { return this; }
}
Instead of binding
{Binding Converter={StaticResource TooltipConverter}}
use
{Binding ItSelf, Converter={StaticResource TooltipConverter}}
Then you raise OnPropertyChanged
for ''ItSelf'' for every property. So you can signal an update for the whole object whenever it was used in a binding.
public DateTime Start
{
get { return this.start; }
set { this.start = value; OnPropertyChanged("Start"); OnPropertyChanged("ItSelf");
}
I got this to work a bit faster but would like to test out AttachedBehavior
for this like stated by @AnatoliiG so I will accept an answer later.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With