Binding to usercontrol property does not update

Please post public support tickets here. Note: for private support tickets, please send an email to support@cshtml5.com instead.
tn1
Posts: 2
Joined: Mon Oct 03, 2016 11:06 pm

Binding to usercontrol property does not update

Postby tn1 » Mon Oct 03, 2016 11:20 pm

I'm testing a simple case of a user control which has a custom dependency property. When using this usercontrol the twowaybinding to the new property does not seem to update.

Steps to recreate:
Create usercontrol which contains a textbox. The usercontrol has a custom dependency property which is bound in the usercontrol to the textbox text property. When this usercontrol is instantiated in the mainwindow and the usercontrol's text property is bound to a local property the update does not occur. The usercontrol's property is being updated (debugging in the simulator), but the change does not propagate back to the original binding in the mainwindow.

All bindings are twoway. We use this a lot in our original Silverlight application (where it works).

Code extract:
public partial class ucEditBox : UserControl
{
...
// DependencyProperty: Text
public static readonly DependencyProperty TextProperty =
DependencyProperty.Register("Text", typeof(string), typeof(ucEditBox), null);

public string Text
{
get { return (string)GetValue(TextProperty); }
set { SetValue(TextProperty, value); }
}

...
}

Xaml:
<UserControl
x:Class="XX1.ucEditBox"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Name="ctrlEdit"
xmlns:local="using:XX1">
<StackPanel x:Name="LayoutRoot" Orientation="Horizontal" HorizontalAlignment="Left" Height="26" >
<TextBox x:Name="txt"
Text="{Binding Text, Mode=TwoWay, ElementName=ctrlEdit}"
MinWidth="{Binding ElementName=ctrlEdit, Path=MinWidthEdit, Mode=OneWay}"
TextAlignment="{Binding ElementName=ctrlEdit, Path=TextAlignment, Mode=OneWay}"
/>
</StackPanel>
</UserControl>

JS-Support @Userware
Site Admin
Posts: 1142
Joined: Tue Apr 08, 2014 3:42 pm

Re: Binding to usercontrol property does not update

Postby JS-Support @Userware » Tue Oct 04, 2016 12:06 am

Hi,

Thank you for reporting this issue.

It indeed appears to be a defect.

We are going to fix it asap.

I'll keep you updated.

Regards,
JS-Support

tn1
Posts: 2
Joined: Mon Oct 03, 2016 11:06 pm

Re: Binding to usercontrol property does not update

Postby tn1 » Wed Nov 23, 2016 3:11 am

Any idea when this is planned to be fixed?


Return to “Technical Support”

Who is online

Users browsing this forum: No registered users and 38 guests

 

 

cron