uwpBinding vs x:Bind


Syntax

  • <object property="{x:Bind}" .../>

  • <object property="{x:Bind propertyPath}" .../>

  • <object property="{x:Bind Path=propertyPath}" .../>

  • <object property="{x:Bind [bindingProperties]}" .../>

  • <object property="{x:Bind propertyPath, [bindingProperties]}" .../>

  • <object property="{x:Bind Path=propertyPath, [bindingProperties]}" .../>

Remarks

The {x:Bind} markup extension—new for Windows 10—is an alternative to {Binding}.

{x:Bind}lacks some of the features of {Binding}, but it runs in less time and less memory than {Binding} and supports better debugging.

At XAML load time, {x:Bind} is converted into what you can think of as a binding object, and this object gets a value from a property on a data source. The binding object can optionally be configured to observe changes in the value of the data source property and refresh itself based on those changes. It can also optionally be configured to push changes in its own value back to the source property. The binding objects created by {x:Bind} and {Binding} are largely functionally equivalent. But {x:Bind} executes special-purpose code, which it generates at compile-time, and {Binding} uses general-purpose runtime object inspection. Consequently, {x:Bind} bindings (often referred-to as compiled bindings) have great performance, provide compile-time validation of your binding expressions, and support debugging by enabling you to set breakpoints in the code files that are generated as the partial class for your page. These files can be found in your obj folder, with names like (for C#) .g.cs.

For more information please see the MSDN documentation on x:Bind