c# - An exception of type 'System.Exception' using a converter XAML -


i using ivalueconverter in xaml in windows phone app. code

<textblock margin="0,0,10,0"            text="{binding score, converter={staticresource secondstominuteshour}}"            foreground="{binding deviceid, converter={staticresource fontforegroundconverter}}"            fontweight="{binding deviceid, converter={staticresource fontweightconverter}}"            grid.column="3" /> 

however converter raised error

an exception of type 'system.exception' occurred in system.windows.ni.dll , wasn't handled before managed/native boundary

score type string , converter class follow

public class secondstominuteshour : ivalueconverter {     public object convert(object value, type targettype, object parameter, cultureinfo culture)     {         int secs = int.parse(value.tostring());         timespan ts = timespan.fromseconds(secs);          return string.format("{0:d2}:{1:d2}:{2:d2}",                         ts.hours,                         ts.minutes,                         ts.seconds);     }      public object convertback(object value, type targettype, object parameter, cultureinfo culture)     {         throw new notimplementedexception();     } } 

what missing?

i figured out.. have include reference of secondstominuteshour converter in application.resources section

....   <application.resources>     <settings:appsettings x:key="appsettings" />     <app:secondstominuteshour x:key="secondstominuteshour" /> .... 

Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -