listview - WPF The property 'Content' cannot be data bound to a visual element -


i have list view , on first column try bind index of underlying collection.

<window.resources>     <local:indexconverter x:key="indexconverter" /> </window.resources> .... <listview>     <listview.view>         <gridview>                       <gridviewcolumn>                 <gridviewcolumn.celltemplate>                     <datatemplate>                         <label width="70" height="40"  content="{binding relativesource={relativesource ancestortype=listviewitem}, converter={staticresource indexconverter}}"></label>                         <!-- more stuff -->                     </datatemplate>                 </gridviewcolumn.celltemplate>             </gridviewcolumn>         </gridview>     </listview.view> </listview>  // indexconverter public object convert(object value, type targettype, object parameter, cultureinfo culture) {      // row number. part working.      // return formatted row number      return string.format("#{0}", rownumber); } 

when compile following error:

the property 'content' cannot data bound visual element.

what wrong binding?

i think trying bind directly list view item (which visual element guess) content : don't see path binding, source.

try bind content

<label width="70" height="40"  content="{binding path=something,relativesource=relativesource ancestortype=listviewitem},converter={staticresource indexconverter}}"> 

Comments

Popular posts from this blog

c# - Operator '==' incompatible with operand types 'Guid' and 'Guid' using DynamicExpression.ParseLambda<T, bool> -