Sunday, 15 August 2010

xaml - Wpf Style: Binding to Child Property via ElementName -



xaml - Wpf Style: Binding to Child Property via ElementName -

i have application gives me alternative alter application-theme via ressourcedictionary, meaning can utilize pure xaml.

now, want hide dockpanel, not have elementname, has kid x:name property.

<style targettype="dockpanel"> <setter property="visibility" value="{binding relativesource={relativesource self}, path=child.visibility}"/> </style>

with code i´m getting first kid of dockpanel, want bind value specific kid has unique elementname.

so not every dockpanel disappears, 1 has kid of type e.g. "textbox" elementname of "mytextbox".

anybody has thought how that? ;-)

got working dockpanel has border parent , code can set visibility of border hidden!

<style targettype="border"> <style.triggers> <datatrigger binding="{binding relativesource={relativesource self}, path=child.children[2].name}" value="searchtextbox"> <setter property="visibility" value="hidden"/> </datatrigger> </style.triggers> </style>

possible improvement: not reference textbox per index, iterate through childs...

wpf xaml

No comments:

Post a Comment