2016-09-13 5 views
0

x : Bind를 사용하여 데이터를 바인딩 할 때 xaml에서 작동하지만 동일한 코드가 x : Bind 대신 Binding을 사용하여 실행될 때 작동하지 않습니다. 왜 이런 일이 일어 납니까 ?? 나는 그들의 차이점을 하나는 런타임 및 기타 컴파일 시간과 그런 것들을 말하는 읽었지만 전혀 도움이되지 않습니다. 누구든지 실용적인 수준에서 나를 도울 수 있습니까 ??x 사이의 차이 : 바인딩 및 바인딩

+2

당신이 봤어 [this] (https://msdn.microsoft.com/en-gb/windows/uwp/xaml-platform/x-bind-markup-extension) 또는 [this] (https://msdn.microsoft.com/ko) -gb/windows/uwp/data-binding/data-binding-in-depth) 또는 [this] (https://github.com/Microsoft/Windows-universal-samples/tree/master/Samples/XamlBind) 또는 [ 이] (http://stackoverflow.com/questio) ns/32582303/binding-vs-xbind-static-source-as-a-default-and-their-differences-d-d) 또는 [this] (http://stackoverflow.com/questions/37398038/difference-between - 바인딩 및 xbind)? 이 질문은 여러 번 전에 묻고 대답했습니다. –

답변

1

x : bind를 사용하면 모델 클래스 인스턴스의 멤버 만 바인딩 할 수 있습니다. 당신이
모델 클래스 인스턴스의 멤버를 결합 할 수 있으며 또한 전체 인스턴스를 바인딩 할 수 바인딩을 통해

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

(현재 개체를. 단지 그 하나의 속성)

//you can send only instance property (Gender) to the converter 
<DataTemplate x:DataType="Models:Human"> 
       <StackPanelHorizontalAlignment="Stretch" Background="{x:Bind Gender, Converter={StaticResource UnwantedDayColorConverter}}">