i can events under headers, can't event clicking headers. here's xaml; notice event entire listview, should activate when clicked:
<listview x:name="mylistview" mouseleftbuttonup="mylistview_mouseleftbuttonup" margin="10"> <listview.view> <gridview> <gridview.columns> <gridviewcolumn header="file path" displaymemberbinding="{binding path=path}" /> <gridviewcolumn header="file size" displaymemberbinding="{binding path=size}" /> </gridview.columns> </gridview> </listview.view> </listview> and event simple. show me has happened:
private void mylistview_mouseleftbuttonup(object sender, mousebuttoneventargs e) { string output = sender.tostring(); messagebox.show(output); } clicking anywhere under headers responds perfectly:
"system.windows.controls.listview items.count:0"
clicking "file path" header nothing. clicking "file size" header nothing.
msdn says:
https://msdn.microsoft.com/en-us/library/vstudio/ms745786(v=vs.100).aspx
<listview x:name='lv' height="150" horizontalalignment="center" verticalalignment="center" gridviewcolumnheader.click="gridviewcolumnheaderclickedhandler"> visual studio says there's no such thing gridviewcolumnheader, none of code on msdn works.
that's how wpf ui events work default. bubble up. if eats message along way (which button type controls do), higher level controls won't it. can either use preview version of event, or cleaner way it:
addhandler(gridviewcolumnheader.clickevent, new routedeventhandler(listview_oncolumnclick));
Comments
Post a Comment