c# - Binding Listbox.ItemContainerStyle to current item property -


in c# windows store app, trying bind visibility property of listboxitem property exists each of items in itemssource.

basically have this:

class exampleclass {      bool isvisible; } 

and in datacontext have list of exampleclass. trying listbox following:

<listbox x:name="examplelb" datacontext=""{staticresource mycontext}" itemssource="{binding exampleclasslist}">     <listbox.itemcontainerstyle>         <style targettype="listboxitem">             <!--this doesnt work-->             <setter property="visibility" value="{binding isvisible, converter={staticresource visibilityconverter}"/>         </style>     </listbox.itemcontainerstyle>     /*more code here*/ </listbox> 

but unable bind isvisible property inside of listbox.itemcontainerstyle. instead wants me bind property of datacontext instead. if move down few lines listbox.itemtemplate able bind properties of individual exampleclass items in itemssource, why not able bind same properties few lines above inside of itemcontainerstyle?

you can't bind field. you'll need make property , implement inotifypropertychanged.

bool isvisible; public bool isvisible {   { return isvisible;}   set   {     isvisible = value;     onpropertychanged("isvisible");   } } 

Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -