wpf - Using Visibilty with DataContext doesn't work in Button -
i have button trying add visibility attribute binds path. in cases path call , return visibilty(hidden or visible). if have button has datacontext set different binded path , try add visiblity stuff, visibilty binded path never gets called. if remove datacontext visibilty works fine. there kind of work around this? why happen? thank very much.
<button visibility="{binding path=thisbuttonvisibility}" datacontext="{binding path=thisbuttondatacontext}"
as set datacontext on button , make after databinding "inside" of button binding relative datacontext got set. searches property thisbuttondatacontext.thisbuttonvisibility.
normally button inherits datacontext parent, set explicit 1 wont find anymore overlaying datacontext.
so said: datacontext valid in element itself, not in content.
so can do: move visibility in object thisbuttondatacontext , works
Comments
Post a Comment