i have dockpanel set this
<window ... > <dockpanel x:name="mydock" datacontext="{binding honapoklist}" > inside dockpanel there textbox, this
<textbox x:name="tbcount" text="{binding path=count,mode=oneway}" /> </dockpanel> </window> this how set honapoklist, it's list string>
public list<string> honapoklist; public mainwindow() { initializecomponent(); honapoklist = new list<string>(); honapok.itemssource = honapoklist; honapoklist.add("january"); honapoklist.add("february"); honapoklist.add("march"); } i want textbox display number of elements in honapoklist ( 3 in example), nothing in it. why that?
window doesn't have default datacontext, looks you're assuming set itself. can set either in constructor:
datacontext = this; or in xaml:
<window datacontext="{binding relativesource={relativesource self}}"> you're going need change honapoklist property, not field now, in order bind it.
Comments
Post a Comment