wpf - How to use a data trigger in a text box that uses the selectedItem of a dataGrid? -
i want use data trigger in text box set isenabled property according value of property of selected item in data grid.
i trying this:
<textbox.style> <style targettype="textbox"> <style.triggers> <datatrigger binding="{binding mydatagridname, elementname=selecteditem.myproperty1.myproperty2}" value="1"> <setter property="isenabled" value="false"/> </datatrigger> </style.triggers> </style> </textbox.style>
but textbox enabled. check when select item, has property1 , property2 has 1 value. guess problem don't set trigger correctly.
try code, need specify datagrid elementname not selecteditem:
<textbox.style> <style targettype="textbox"> <style.triggers> <datatrigger binding="{binding elementname=mydatagridname, path=selecteditem.myproperty1.myproperty2}" value="1"> <setter property="isenabled" value="false"/> </datatrigger> </style.triggers> </style> </textbox.style>
Comments
Post a Comment