c# - Issue with detached binding at initialization for element not in visualtree for WPF UserControl -
i have had issue wpf of lately. properties not in visualtree have no way of getting datacontext work bindings out. provide example.
<path> <path.data> <combinedgeometry> <combinedgeometry.geometry1> <rectanglegeometry.transform> <scaletransform scaley="{binding whatscale, converter={staticresource dosomethingawesome}, fallbackvalue=1, targetnullvalue=1}"/> </rectanglegeometry.transform> </combinedgeometry.geometry1> ... </combinedgeometry> </path.data> </path> i worked out adding dummy reference object , adding source of binding
<frameworkelement x:name="dummyelement"/> ... scaley="{binding datacontext.whatscale, converter="{staticresource dosomethingawesome}", source="{x:reference dummyelement}}" however: still these annoying information console messages saying
bindingexpression cannot retrieve value null data item. happen when binding detached or when binding nullable type has no value. bindingexpression:path=datacontext.whatscale the usercontrol rendered itemscontrol , issue believe datacontext null when initialized , directly after set code still works. however, dont "information" get, want understand happens , how can avoid it.
thanks!
Comments
Post a Comment