Sunday, 15 August 2010

wpf controls - WPF Datagrid Browse Button Issue -



wpf controls - WPF Datagrid Browse Button Issue -

we have wpf application, in utilize datagrid on 1 form. our requirement in 1 column of datagrid there onr button, after clicking inquire browse file, & take path of file. afterward path set textblock replaced same button. need done? able path, how show textblock after selecting path browsing.

<toolkit:datagridtemplatecolumn header="attachment re-create of invoice" width="180" > <toolkit:datagridtemplatecolumn.celltemplate> <datatemplate> <textblock x:name="attach" uid="ata" text="{binding path=attachment, updatesourcetrigger=propertychanged}" /> </datatemplate> </toolkit:datagridtemplatecolumn.celltemplate> <toolkit:datagridtemplatecolumn.celleditingtemplate> <datatemplate> <button name="click" click="click_click" ></button> </datatemplate> </toolkit:datagridtemplatecolumn.celleditingtemplate> </toolkit:datagridtemplatecolumn>

first of should not handle button_click in way. should place icommand somewhere in viewmodel , bind button command.

second, need show new text in textblock update attachment property you're binding to:

<toolkit:datagridtemplatecolumn.celleditingtemplate> <datatemplate> <button command="{binding mycommand}"/> </datatemplate> </toolkit:datagridtemplatecolumn.celleditingtemplate>

viewmodel:

public class myviewmodel { public delegatecommand mycommand {get;set;} public myviewmodel() { mycommand = new delegatecommand(executemycommand); } private void executemycommand(object parameter) { attachment = whateveryouwanttoplacethere; } }

wpf wpf-controls wpfdatagrid wpftoolkit

No comments:

Post a Comment