public void BindToText5 () { // Fails in Silverlight 3 Binding binding = new Binding ("Prop"); binding.Source = "string"; TextProp prop = new TextProp (); prop.SetBinding (TextProp.MyTextProperty, binding); Assert.IsNull (prop.MyText, "#1"); }
public void BindDpToDp_BindingExpressionType () { // See what happens if we have a twoway binding of property type 'BindingExpressionBase'. // Normally the value would be copied to the datasource, but in this case we just replace // the existing twoway binding. var data = new TextProp { }; var target = new TextProp { }; var binding = target.SetBinding (TextProp.WidthProperty, new Binding { Mode = BindingMode.TwoWay, Path = new PropertyPath ("Opacity"), Source = new OpacityObject { Opacity = 0.5 }, }); target.ClearValue (TextProp.WidthProperty); target.SetBinding (TextProp.MyBindingExpressionProperty, new Binding { Source = data, Path = new PropertyPath ("MyBindingExpression"), Mode = BindingMode.TwoWay, }); target.SetValue (TextProp.MyBindingExpressionProperty, binding); Assert.AreSame (binding, target.ReadLocalValue (TextProp.MyBindingExpressionProperty), "#1"); }