c# - Listview template with link -
i have listview:
<listview verticalalignment="top" width="210" height="150" selectedvaluepath="selectedfile" selectionmode="single" selectedindex="0" behaviour:commandsbehaviour.selectionchanged = "{binding selectionfilechange}" itemssource="{binding files}" issynchronizedwithcurrentitem="true" atachedproperties:gridviewsort.autosort="true" atachedproperties:gridviewsort.showsortglyph="true"> <listview.view> <gridview> <gridview.columns> <gridviewcolumn header="file name" width="100" displaymemberbinding="{binding name}"/> <gridviewcolumn header="date" width="100" displaymemberbinding="{binding date}"/> </gridview.columns> </gridview> </listview.view> </listview>
i want when click file name (only file name, not date) file opened (or custom action matter), i.e column filename link. how can this?
you can use hyperlink inside datatemplate
<listview verticalalignment="top" width="210" height="150" selectedvaluepath="selectedfile" selectionmode="single" selectedindex="0" itemssource="{binding files}" > <listview.view> <gridview> <gridview.columns> <gridviewcolumn width="auto" header="url" > <gridviewcolumn.celltemplate> <datatemplate> <textblock name="name" minwidth="100" width="auto"> <hyperlink navigateuri="{binding path=name}" name="nameurl" requestnavigate="openpagerequestnavigate"> <textblock text="{binding path=name}"/> </hyperlink> </textblock> </datatemplate> </gridviewcolumn.celltemplate> </gridviewcolumn> </gridview.columns> </gridview> </listview.view> </listview>
Comments
Post a Comment