I'm a long-time C# programmer but I'm completely new to WPF and XAML. I can find plenty of tutorials that say "this is how to achieve this specific thing" but not "this is why you do this to achieve this specific thing". I'm seriously struggling to understand the meaning of various syntax in XAML.
In this case, what do curly braces in attributes actually mean? What do they get translated to in terms of code? How do I reason about them? How do they get interpreted? Why does there seem to be multiple syntaxes (Binding="{Binding someProperty}" vs Binding="{Binding path=someProperty}")?
I must be missing something obvious, but I've spent literally days reading tutorials, watching tutorials, even fighting my way through the immensely dry and difficult-to-understand Microsoft documentation and I still can't seem to figure it out.
Let me try to illustrate where I'm getting stuck.
For example, say I was given this:
int result = SomeUnknownFunction(42, 79);
I don't have to know what SomeUnknownFunction does to reason about what's happening here. I can say, ok, the first part defines a new variable of type int, the second part runs some function with two inputs, and the equals sign assigns the result of that function to the variable.
Now say I was given this:
<TextBox Text="{Binding Name}">
I can say, ok, when the XAML parser gets to this bit, the C# code it spits out creates an object instance of type TextBox. That class has (or inherits) a property called Text, and we're setting it to... uh... some magic syntax inside curly braces...
This is where I'm stuck. I think some part of this is called a "markup extension" (which is the most incredibly generic and meaningless name possible), but I can't even figure out if that means "the curly braces and everything inside" or just "the Binding part". Sometimes there's an equals sign inside the curly braces, sometimes not. What's the difference? The word Binding is a... something? Is it a function and we're passing in Name, and it returns a new Binding object that is somehow assigned to the Binding property?





