0

When I bind data using x:Bind in my xaml it works, but when the same code is executed using Binding in place of x:Bind, it doesn't. Why does this happen ?? I have read their difference saying one is runtime and other compile time and stuff like that but that doesn't help at all. Can anyone help me on a practical level??

Monish Koyott
  • 374
  • 1
  • 4
  • 20
  • 3
    Have you looked at [this](https://msdn.microsoft.com/en-gb/windows/uwp/xaml-platform/x-bind-markup-extension) or [this](https://msdn.microsoft.com/en-gb/windows/uwp/data-binding/data-binding-in-depth) or [this](https://github.com/Microsoft/Windows-universal-samples/tree/master/Samples/XamlBind) or [this](http://stackoverflow.com/questions/32582303/binding-vs-xbind-using-staticresource-as-a-default-and-their-differences-in-d) or [this](http://stackoverflow.com/questions/37398038/difference-between-binding-and-xbind)? This question has been asked and answered many times before. – Mike Eason Sep 13 '16 at 07:17

1 Answers1

2

using x:bind you can bind only a member of model class instance.

 //sends whole current instance to the converter.
//(note: yes you see correct. no property is attached after Binding keyword
  ....
<DataTemplate x:DataType="Models:Human">
<StackPanel Background="{Binding Converter={StaticResource UnwantedDayColorConverter}}">
 ....

via Binding you can bind only a member of model class instance
and also you can bind whole instance (current object. not just its single property)

 //you can send only instance property (Gender) to the converter
 <DataTemplate x:DataType="Models:Human">
                <StackPanelHorizontalAlignment="Stretch" Background="{x:Bind Gender, Converter={StaticResource UnwantedDayColorConverter}}">
Zen Of Kursat
  • 2,672
  • 1
  • 31
  • 47