Cannot bind value from listview item
romgerman opened this issue · 3 comments
Inside ListView.ItemTemplate
i have this code
<TextBlock>
<i:Interaction.Behaviors>
<behaviors:MultiBindingBehavior PropertyName="Text" Converter="{StaticResource UserToPresence}">
<behaviors:MultiBindingItem Value="{Binding}" />
<behaviors:MultiBindingItem Value="{Binding DataContext.Client, ElementName=ThisPage}" />
</behaviors:MultiBindingBehavior>
</i:Interaction.Behaviors>
</TextBlock>
And the first binding item is null
always. I don't understand why it doesn't bind to local data context. What can be the problem?
Assuming you are you targetting UWP only, I'd recommend using x:bind
with a function instead as that is quite better nowadays than the old Bindings
!
Alright. For some reason the first time converter gets called it gets null but the second time it's called it gets the value. Added checking for null. Thanks for the answer! Didn't expect it so quickly.
For the record, that is actually expected, as the properties are set (and the change notification) raised one by one, hence why you get two calls with the first having one of the properties null
.