Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1564
Put a link into a cell ?
posted

Hi,

 

I would like to put a link into a cell of the grid, I need to have a "link" style (blue and underscore) but also once I click on the link
it open a browser and jump to the URL. 

I know how to customize the style.

But how can I handle the click event on a column/cell ? 

Thanks 

Parents
No Data
Reply
  • 4850
    Verified Answer
    Offline posted

    One way is to listen for the PreviewMouseLeftButtonDown event.

    private void xamDataGrid1_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)

    {

    DependencyObject source = e.OriginalSource as DependencyObject;

    if ( source == null ) return;

    CellValuePresenter cvp = Infragistics.Windows.Utilities.GetAncestorFromType(source, typeof(CellValuePresenter), true) as CellValuePresenter;

    if (cvp == null) return;

    if (cvp.Field.Name == "MyLinkField")

    {

    // do stuff here

    e.Handled = true;

    }

    }

Children