avataren
Topic Author
Posts: 9
Joined: 02 Jun 2022, 13:11

Binding property to different element does not update UI

05 Oct 2022, 11:28

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.
 
avataren
Topic Author
Posts: 9
Joined: 02 Jun 2022, 13:11

Re: Binding property to different element does not update UI

05 Oct 2022, 13:15

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 :)
 
User avatar
sfernandez
Site Admin
Posts: 3363
Joined: 22 Dec 2011, 19:20

Re: Binding property to different element does not update UI

11 Oct 2022, 10:34

Thanks for the update, closing this then.

Who is online

Users browsing this forum: No registered users and 5 guests