c# - Value Converter not Being Called XAML -
i have put breakpoints inside value converter , never triggered, page renders no image being shown.
the xaml:
xmlns:datatypes="clr-namespace:datatypes_portable;assembly=datatypes_winphone8" ... <phone:phoneapplicationpage.resources> <datatypes:winphone8imageconverter x:key="imageconverter" /> </phone:phoneapplicationpage.resources> ... <image x:name="levelimage" horizontalalignment="left" height="auto" verticalalignment="top" width="auto" margin="0" grid.columnspan="5" source="{binding converter={staticresource imageconverter}, path=app.main.game.currentlevel.currentpart.image}"/>
the cs:
public class winphone8imageconverter : ivalueconverter { public object convert(object value, type targettype, object parameter, cultureinfo culture) { var imageprovider = value winphone8imageprovider; return imageprovider.image; } public object convertback(object value, type targettype, object parameter, cultureinfo culture) { throw new notimplementedexception(); } }
from can understand (by process of trial , elimination , looking @ exceptions thrown) problem coming part of xaml trying bind value.
at breakpoint value @ app.main.game.currentlevel.currentpart.image
being set correctly (ie instance of winphone8imageprovider
).
it turns out nothing converter @ all. value binding before image had loaded (so source empty). future reference check make sure implementing theinotifypropertychanged
correctly in view models.
Comments
Post a Comment