uwpBinding vs x:Bind


  • <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]}" .../>


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

Evaluating {x:Bind} from functions

This ability was added to the Bind markup extension after v1607 (Redstone 1).
You can specify a function path, as well as arg paths and constant args. Let's assume we have a function defined in our backcode:

public string Translate(string text, string from, string to)

Now we can use bind to evaluate the function into the element we want:

<TextBlock Name="SomeText" Text="How are you?" />
<TextBlock Name="{x:Bind Translate(SomeText.Text, 'en', 'es')}" />

Function and arg paths can contain dots and casts as well.