Binding property to different element does not update UI
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.
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.
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.
Code: Select all
<TextBlock Margin="20,0,0,0" Text="{Binding ElementName=VideoRenderer, Path=FrameRate}" Foreground="{StaticResource MetricsColor}" FontSize="32"/>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
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 :)
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 :)
-
-
sfernandez
Site Admin
- Posts: 3363
- Joined:
Re: Binding property to different element does not update UI
Thanks for the update, closing this then.
Who is online
Users browsing this forum: No registered users and 5 guests