Last active
August 29, 2015 14:03
-
-
Save isidore/17921d43012ff77829f7 to your computer and use it in GitHub Desktop.
WpfBindings
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binding myBinding = new Binding(TestViewModel.MyPropertyPropertyName); | |
WpfBindingsAssert.BindsWithoutError(viewModel, () => | |
{ | |
// ... create control and initalize bindings | |
// (This will happen once the reporting and logging has been setup) | |
var textBox = new TextBox(); | |
textBox.SetBinding(TextBox.TextProperty, myBinding); | |
return textBox; | |
}); | |
/************************************************ | |
If this fails you will get an exception like: | |
System.Windows.Data Error: 40 : BindingExpression path error: 'MyProperty' property not found on 'object' ''TestViewModel' (Hashcode)'. | |
BindingExpression:Path=MyProperty | |
DataItem='TestViewModel' (Hashcode) | |
target element is 'TextBox' (Name='') | |
target property is 'Text' (type 'String') | |
*************************************************/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment