Hello!
If you work with XAML for sure you know the label x:Binding, we usually use it to associate code behind properties with XAML views. With the arrival of Windows Universal Apps for Windows 10 to have an evolution of that tag x:Bind.
The way to use it is very similar. This is the Binding that we already know from WPF
and now we can also use
Reading a little about this new label (see references below), I see that it improves performance at runtime (something that we always appreciate). To achieve this, it generates strongly typed code to manage the bindings. This brings us to an interesting scenario: “have the ability of validating our Bindings at compile time”
This means that, if for example, we are associating the text of a TextBlock to a “Messages” property, if it does not exist in the class defined in the namespace “x:”, for they will be a compilation error.
Now, after knowing this, first thing I did was try to change all the Binding by Bind, and I learned a couple of things
- The way in which Bind handles data types and Paths is slightly different, in some cases, not only is change Binding by Bind, but also specify the correct path to the object in the ViewModel
- The Binding default mode is Mode=OneWay, and Bind is Mode=OneTime. If no specific mode you need in your XAML you can have some surprises
So well, I would recommend using Bind whenever possible. But if you already have code created with Binding, it is certainly necessary to test it before doing a massive update!
Greetings @ Madrid
-El Bruno
References
Hi,
Be sure to include x:DataType=”local:Project” if you are using a
Regards
Juanlu
LikeLike
Hi,
Be sure to include x:DataType=”local:Project” if you are using a “DataTemplate”
Regards
Juanlu
LikeLike