c# - "Hyperlink.Click" event not being fired for DataGridHyperlinkColumn -
i have wpf form datagrid
containing multiple datagridhyperlinkcolumn
, hyperlink.click
handler set up.
gamesgrid.xaml:
<usercontrol xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:steamwishlist" x:name="gamesgridcontrol" x:class="myprogram.gamesgrid" mc:ignorable="d" d:designheight="300" d:designwidth="300"> <grid> <datagrid x:name="datagrid" autogeneratecolumns="false" canusersortcolumns="false" selectionunit="cell" selectionmode="single" arerowdetailsfrozen="true" canuserresizerows="false" > <datagrid.columns> <datagridhyperlinkcolumn clipboardcontentbinding="{x:null}" binding="{binding url}" contentbinding="{binding name}" header="name"> <datagridhyperlinkcolumn.elementstyle> <style> <eventsetter event="hyperlink.click" handler="dg_hyperlink_click"/> </style> </datagridhyperlinkcolumn.elementstyle> </datagridhyperlinkcolumn> <datagridhyperlinkcolumn clipboardcontentbinding="{x:null}" binding="{binding installlink}" header="install"> <datagridhyperlinkcolumn.elementstyle> <style> <eventsetter event="hyperlink.click" handler="dg_hyperlink_click"/> </style> </datagridhyperlinkcolumn.elementstyle> </datagridhyperlinkcolumn> </datagrid.columns> </datagrid> </grid> </usercontrol>
gamesgrid.xaml.cs:
public partial class gamesgrid : usercontrol { ... private void dg_hyperlink_click(object sender, routedeventargs e) { hyperlink link = (hyperlink)e.originalsource; process.start(link.navigateuri.absoluteuri); } }
a few weeks ago exact code worked fine, today event not being fired - if set breakpoint in dh_hyperlink_click
, it's never reached.
i'm not sure start debugging issue. has else encountered before?
of course, problem turned out yet random wpf bug, sigh.
apparently if set datagrid.itemsource
after await
inside textbox.lostkeyboardfocus
callback, breaks datagridhyperlinkcolumn.hyperlink.click
event. why? have no idea.
i tried think of work around issue, nothing worked. in end had stop using await
inside callback , handle asynchronous events manually. sigh.
Comments
Post a Comment