c# - XamlParseException when using converter -


i getting xamlparseexception when try use converter. suspect made mistake in converter can't catch it.

full error text:

a first chance exception of type 'system.windows.markup.xamlparseexception' occurred in system.windows.ni.dll

additional information: cannot create instance of type 'app.converters.dimensiontotext' [line: 21 position: 42]

namespace app.converters {     class dimensiontotext : ivalueconverter     {         public object convert(object value, type targettype,             object parameter, cultureinfo culture)         {             dimensions dim = (dimensions) value;             //bool param = (bool) parameter;             return dim.width.tostring().trim() + "\"x " + dim.length.tostring().trim() + "\"x " + dim.height.tostring().trim() + "\"";         }          public object convertback(object value, type targettype,                 object parameter, cultureinfo culture)         {             return value;         }     } } 

xaml parts:

xmlns:converter="clr-namespace:app.converters" ... <phone:phoneapplicationpage.resources>     <converter:dimensiontotext x:key="dimensiontotext"/> </phone:phoneapplicationpage.resources> ... <textblock style="{staticresource phonetextnormalstyle}">      <run text="dimensions:"/>     <run text="{binding information.dimensions, converter={staticresource dimensiontotext}}"/> </textblock> 

strangely in design time converter works fine. suggestions appreciated

make converter public

namespace app.converters {     public class dimensiontotext : ivalueconverter     {         public object convert(object value, type targettype,             object parameter, cultureinfo culture)         {             dimensions dim = (dimensions) value;             //bool param = (bool) parameter;             return dim.width.tostring().trim() + "\"x " + dim.length.tostring().trim() + "\"x " + dim.height.tostring().trim() + "\"";         }          public object convertback(object value, type targettype,                 object parameter, cultureinfo culture)         {             return value;         }     } } 

Comments

Popular posts from this blog

java - Intellij Synchronizing output directories .. -

git - Initial Commit: "fatal: could not create leading directories of ..." -