wpf - Does StringFormat work with this.DataContext -
i binding textblock collection in code-behind via this.datacontext = sellerlist; output correct when apply stringformat, see no result. following code textblock on xaml page
<textblock name="datedtkey" grid.row="1" grid.column="2" horizontalalignment="right" verticalalignment="bottom" text="{binding path=date, stringformat={}{0:dd-mm-yyyy}}" style="{staticresource textstyletextblock}"/>
the source binding string, if detailssellerlistingtemplate
resource should use {staticresource detailssellerlistingtemplate}
. also, textblock doesn't need datacontext binding work since it's using source.
<window.resources> <local:detailsseller x:key="detailssellerlistingtemplate"/> </window.resources> <textblock name="datedtkey" horizontalalignment="right" verticalalignment="bottom" text="{binding source={staticresource detailssellerlistingtemplate}, path=date, stringformat={}{0:dd-mm-yyyy}}"/>
this work if detailsseller
looks similar this
public class detailsseller { public detailsseller() { date = datetime.now; } public datetime date { get; set; } }
you talked collection can't see how fits binding, maybe missunderstood in question
Comments
Post a Comment