When is the “Path=” xaml syntax required when specifying a binding to a property?
I see this “Path=” pretty much exclusively when there is a nested property binding (ex: Path=Person.FirstName).
Thanks!
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Think of it like initializing a class in C#. If the “Binding” class has a constructor that takes a path, you could do this:
… or this:
The two are the same, for all intents and purposes. XAML is doing the same thing. If you omit the “Path=” you’re passing a path into the constructor for Binding, but if you include it you’re setting the value after the fact.
I often leave the “Path=” out, especially if I’m declaring a binding with no other properties set, like
{Binding FirstName}.