c# - Getting Error in Xaml while Binding data with Converter -
i getting "invalid xaml" error while binding data converter. see screenshot:
this xaml code:
<datatemplate> <border borderbrush="#cbc6c0" borderthickness="3" cornerradius="3" background="#fff9f6f4"> <grid margin="5"> <contentcontrol content="{binding converter={staticresource groupdetails}}" /> </grid> </border> </datatemplate>
... , c# code converter:
public class listdetailsconverter : ivalueconverter { public object convert(object value, type targettype, object parameter, system.globalization.cultureinfo culture) { model_detail objdetail = value model_detail; textblock tbinfo = new textblock(); tbinfo.margin = new thickness(5, 5, 5, 5); tbinfo.textwrapping = textwrapping.wrap; tbinfo.foreground = new solidcolorbrush(colors.black); bold tbtitle = new bold(); string strtitle = objdetail.questiontitle; tbtitle.inlines.add(strtitle); string strdetails = " : " + objdetail.detail; tbinfo.inlines.clear(); tbinfo.inlines.add(tbtitle); tbinfo.inlines.add(strdetails); return tbinfo; } public object convertback(object value, type targettype, object parameter, system.globalization.cultureinfo culture) { throw new notimplementedexception(); } }
at top of page xaml have declared:
xmlns:myconverter="clr-namespace:magnitude_gold.mgconverter" <phone:phoneapplicationpage.resources> <myconverter:listdetailsconverter x:key="groupdetails" /> </phone:phoneapplicationpage.resources>
what wrong this..?
use this, replace model_detail enity or object
<contentcontrol content="{binding path=model_detail converter={staticresource groupdetails}}" />
Comments
Post a Comment