Home Forums WinForms controls Xceed Grid for WinForms Column value as link

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #17014 |

    In my xceed datagridcontrol, there are few values in column 1. i want to make all the values in this column as link, and ensure that when these values

    clicked on, something should happen.

    How can i do that ? Please help.

    Imported from legacy forums. Posted by Neeti (had 3199 views)

    User (Old forums)
    Member
    Post count: 23064

    Are you using the .NET version or the WPF version?

    Imported from legacy forums. Posted by André (had 342 views)

    User (Old forums)
    Member
    Post count: 23064

    .net version of it Andre.

    Imported from legacy forums. Posted by Neeti (had 200 views)

    User (Old forums)
    Member
    Post count: 23064

    You can simply wrap a LinkLabel control in a CellEditorManager and a CellViewerManager on that column, and handle its click event.

    e.g.:

        private void Form1_Load(object sender, System.EventArgs e)
        {     
          gridControl1.SingleClickEdit = true;
         
          LinkLabel link = new LinkLabel();    
          link.LinkColor = Color.Red;

          gridControl1.Columns[ 1 ].CellEditorManager = new CellEditorManager( link, “Text”, true, true );
          gridControl1.Columns[ 1 ].CellViewerManager = new CellViewerManager( new LinkLabel(), “Text” );

          //need to handle these events to get to the LinkLabel click
          gridControl1.Columns[ 1 ].CellEditorManager.ActivatingControl += new CellEditorEventHandler(CellEditorManager1_ActivatingControl);
          gridControl1.Columns[ 1 ].CellEditorManager.DeactivatingControl += new CellEditorEventHandler(CellEditorManager1_DeactivatingControl);
        }

        private void CellEditorManager1_ActivatingControl(object sender, CellEditorEventArgs e)
        {
          ( ( LinkLabel )e.Control).LinkClicked += new LinkLabelLinkClickedEventHandler( LinkEditorManager_LinkClicked );
        }

        private void CellEditorManager1_DeactivatingControl(object sender, CellEditorEventArgs e)
        {
          //need to unsubscribe, if not, the subscribtions will kept pilling up!
          ( ( LinkLabel )e.Control).LinkClicked -= new LinkLabelLinkClickedEventHandler( LinkEditorManager_LinkClicked );
        }

        private void LinkEditorManager_LinkClicked( object sender, LinkLabelLinkClickedEventArgs e )
        {
          System.Diagnostics.Debug.WriteLine( “Cell Link Clicked!” );
        }

     

    Imported from legacy forums. Posted by André (had 2498 views)

    User (Old forums)
    Member
    Post count: 23064

    Thanks a ton Andre.

    I was actually also looking for same code for the WPF version. Could you help with that too !

    Imported from legacy forums. Posted by Neeti (had 278 views)

    User (Old forums)
    Member
    Post count: 23064

    You will need to post your question in the WPF forums :

    http://xceed.com/CS/forums/35/ShowForum.aspx

     

    Imported from legacy forums. Posted by André (had 3305 views)

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.