Search code examples
c#xamlsilverlightcomponentonec1flexgrid

Hyperlink C1Flexgrid Column Data in silverlight


I am using Component one FlexGrid in my silverlight Application and it is autogenerating columns in the grid. I want to make one of the column's data behave as a clickable hyperlink. Any help on this problem would be greatly appreciated.


Solution

  • I have figured out a way to add hyperlink cell in C1FlexGrid. One should extend CellFactory Class and inside the class override method CreateCellContent(C1FlexGrid grid, Border bdr, CellRange range) and write something like this:

    public override void CreateCellContent(C1FlexGrid grid, Border bdr, CellRange range)
        {
          //Ofcourse One should figure out first the col in which they want to       
          //add the cell
           var width = GetWidthForHyperlinkControl((string)grid[range.Row, range.Column]);
           var cell = new HyperlinkControl
                {
                    HorizontalAlignment = HorizontalAlignment.Left,
                    VerticalAlignment = VerticalAlignment.Center,
                    Width = width,
                    Height = 16,
                    NavigateUri = null,
                    IsTabStop = false,
                    Content = (string)grid[range.Row, range.Column]
                };
      }