Improving App’s performance using compile time binding in Universal Windows App.

By | October 19, 2015

Windows 10 Universal Apps has come up with a new binding approach called compile time binding (x:Bind) where the property gets bind to the UIElement during compile time. In previous versions of windows Apps, the binding occurs during the runtime and its completely based on the reflections. This caused the reduction in apps performance.


lets see in detail about the compile time binding.

Create a simple page with just a TextBlock binding to a property called Title (which don’t exist).

<TextBlock Text="{x:Bind Title}" />

and now try to compile the app and the app displays a compile time error as shown below.



But if the same property is used with Binding, the build gets successes and the during run time the app tries to find the property which is binded and try to get the value which leads to reduce apps performance.

By default the mode of x:Bind is OneTime, so the developer has to specify the mode of the property to Either OneWay or TwoWay based on the requirement. But in Binding the default mode is OneWay. Not all the Bindings in the App can be replaced with the x:Bind, there are some limitations with this.

The are two other scenarios that are good to take a note, when the x:Bind is used in a DataTemplate then the developer should specify the data type for the DataTemplate with x:DataType in the in order to make the App compile successfully, if not a compile time error is displayed.


One more thing  to be noted, if the x:Bind is used in the ResourceDictionary then the developer has to specify the Class file for the ResourceDictionary. Normally a ResourceDictionary doesn’t have a code behind file associated with it and also it doesn’t have a class name. In order for x:Bind expressions to be compiled, the ResourceDictionary must be given a class name and have a corresponding code behind file.

Hope this might Help.

2 thoughts on “Improving App’s performance using compile time binding in Universal Windows App.

  1. Pingback: Dew Drop – October 20, 2015 (#2115) | Morning Dew

  2. Pingback: Visual Studio – Developer Top Ten for Oct 22nd, 2015 - Dmitry Lyalin

Comments are closed.