visual studio 2013 - C# visible doesn't works -
i'm making universal application windows phone 8.1 , have problem code.
after textblock value become greater or equal 22, images should become visible. if value less 22 images should invisible.
my question: how can visible images after textblock value >="22"
this code hide images:
private void points_loaded(object sender, routedeventargs e) { int n = 0; bool b = int.tryparse(points.text, out n); datacontext = this; imagevis = (b && n >= 22) ? visibility.visible : isibility.collapsed; } private visibility imagevis; public visibility imagevis { { return imagevis; } set { imagevis = value; raisepropertychanged("imagevis"); } } public event propertychangedeventhandler propertychanged = delegate { }; protected void raisepropertychanged(string propertyname) { propertychanged(this, new propertychangedeventargs(propertyname)); }
this code part xaml:
<image x:name="hole17img" horizontalalignment="left" height="57" margin="10,3540,0,0" verticalalignment="top" width="380" source="assets/septinpatsmit.png" stretch="fill" visibility="{binding imagevis, mode=twoway}"/>
i have problem with: raisepropertychanged("imagevis");
the name 'raisepropertychanged' not exist in current context
does mean have make object name? or else?
i can provide my application can see what's happening.
raisepropertychanged mvvm light's method , makes ui updated whenever raise property given name.in xaml code behind , bind viewmodel's properties xaml properties , when raisepropertychanged triggers , notifies given property , ui refreshed after.
you need use converters convert boolean visibility.in general , need more mvvm pattern knowledge windows projects.
check out post http://www.mvvmlight.net/doc/
Comments
Post a Comment