wpf - Fix binding error for a binding applied in a style -
i getting binding error in output panel when run application:
system.windows.data error: 4 : cannot find source binding reference 'relativesource findancestor, ancestortype='system.windows.shapes.ellipse', ancestorlevel='1''. bindingexpression:path=width; dataitem=null; target element 'translatetransform' (hashcode=59715965); target property 'x' (type 'double')
i trying create style apply translatetransform on ellipses in canvas. binding works, when start application, error in output panel. how can fix error?
edit: binding work, want rid of error in visual studio output window.
if move rendertransform style ellipse
tag, error goes away, want transform used within style because needs applied many ellipses.
this xaml using:
<window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:class="wpfapplication1.mainwindow" title="mainwindow" height="300" width="300"> <window.resources> <style targettype="ellipse"> <setter property="rendertransform"> <setter.value> <translatetransform> <translatetransform.x> <binding relativesource="{relativesource mode=findancestor, ancestortype={x:type ellipse}}" path="width"/> </translatetransform.x> </translatetransform> </setter.value> </setter> </style> </window.resources> <canvas> <ellipse width="100" height="100" fill="red" /> </canvas> </window>
it looks issue in wpf, 1 microsoft won't fix.
more info here:
Comments
Post a Comment