WinRT (Win 8) Store App XAML Bindings RelativeSourceMode FindAncestor missing?

前端 未结 2 563
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-09 05:28

does anybody know what the \"new way\" of FindAncestor in XAML bindings is? Looking at the RelativeSourceMode (http://msdn.microsoft.com/en-us/library/windows/apps/windows.u

2条回答
  •  -上瘾入骨i
    2020-12-09 06:03

    Why it's missing? No idea, but I doubt there's an explanation other than "Microsoft did not have enough time to implement all the features in time".

    An easy work-around is to use ElementName instead, as in:

    Binding={ ElementName=TheNameOfTheAncesor, Path=DataContext.TheViewModelProperyIWantToBindTo }
    

    And to add an x:Name attribute to the ancestor you wanted your FindAncestor binding to point to:

    
    

提交回复
热议问题