Page 1 of 1

Binding property to different element does not update UI

Posted: 05 Oct 2022, 11:28
by avataren
Hi, I have a custom control to display video, this control has no xaml, and is using DrawingContext::DrawImage from OnRender, this works fine.. this control has a few DependencyProperties as well.

I have a different custom control that is xaml based, and it contains the previous videocontrol and a textblock with some layout etc.. the textblock is bound to one of the videocontrols dependencyproperties.
<TextBlock Margin="20,0,0,0" Text="{Binding ElementName=VideoRenderer, Path=FrameRate}"  Foreground="{StaticResource MetricsColor}" FontSize="32"/>
This seems to work fine if I change the default value for the FrameRate DependencyProperty in the videocontrol, or if I change the value in the constructor.

In my case I setup a callback to change the FrameRate property (triggered when a new video frame is available, from elsewhere in the code), and when I change the FrameRate dependencyproperty from this callback the UI does not change (callback is running on the GUI thread).
I have an onchange-callback on the FrameRate property, and this triggers, but ui is showing the default value, or the value I set from constructor.

Any ideas of why this setup does not work as expected would be welcome.

Re: Binding property to different element does not update UI

Posted: 05 Oct 2022, 13:15
by avataren
Ok, so I figured out what the problem was, I had a couple of bugs.
I had misspelled the property name when calling RegisterProperty, which was the reason no change happened in GUI.. the callbacks I thought got triggered, came from another source :)

Re: Binding property to different element does not update UI

Posted: 11 Oct 2022, 10:34
by sfernandez
Thanks for the update, closing this then.