在DataContext中使用Visibilty在Button中不起作用 [英] Using Visibilty with DataContext doesn't work in Button
问题描述
< Button Visibility ={Binding Path = ThisButtonVisibility}
DataContext = {Binding Path = ThisButtonDataContext}
将DataContext绑定到隐含来源。所以你的作业是不正确的,因为Binding表达式将寻找DataContext,它是绑定到DataContext来寻找DataContext,它是Binding,一次又一次地...;)
I have a Button where I am trying to add a Visibility attribute which binds to a certain path. In most cases this path will be call and I return a Visibilty(Hidden or Visible). If I have a button that has a DataContext set to a different binded path and try to add the Visiblity stuff, the visibilty binded path never gets called. If I remove the DataContext then the Visibilty works fine. Is there some kind of work around for this? Why does this happen? Thank you very very much.
<Button Visibility="{Binding Path=ThisButtonVisibility}"
DataContext="{Binding Path=ThisButtonDataContext}"
Binding use DataContext as implicit source. So your assignment is incorrect, because Binding expression will look for DataContext which is Binding to DataContext to look for DataContext which is Binding and again and again... ;)
这篇关于在DataContext中使用Visibilty在Button中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!