c# - Custom calculated field in ListBox with databinding -


i'm making first windows phone 7 app , it's done, except calculated field in listbox.

i have single database id, name, , integer. i'm using mvvm pattern. depending on function calculations, want yo show yes or not value of first field of listbox, , second column simple name. how can show first field?

this code @ moment (for listbox):

    <listbox x:name="lstpills" grid.row="1" itemssource="{binding allitems}">         <listbox.itemtemplate>             <datatemplate>                 <grid horizontalalignment="stretch" width="440">                     <grid.columndefinitions>                         <columndefinition width="90" />                         <columndefinition width="*" />                     </grid.columndefinitions>                     <border height="36" width="60" cornerradius="5" background="grey">                         <textblock text="here goes yes or not" foreground="white" verticalalignment="center" horizontalalignment="center" fontsize="28"/>                     </border>                     <textblock                         text="{binding name}"                         fontsize="{staticresource phonefontsizelarge}"                         grid.column="1"                         verticalalignment="center"/>                 </grid>             </datatemplate>         </listbox.itemtemplate>     </listbox> 

and have class function makes calculation (just example):

    public static bool isright(int value)     {         return (math.abs(value) % 2 == 0 ? true : false);     } 

is there way call function bound parameter in xaml reflects result? like:

<textblock text="isright(binding myvalue)"/> 

i have model , viewmodel.

try binding isright property

private int _lookupvalue; public bool isright     {       {         return (math.abs(_lookupvalue) % 2 == 0 ? true : false);       }     } 

if think still not appliable can go converters.


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -