Hyperlink C1Flexgrid Column Data in silverlight

559 Views Asked by At

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.

2

There are 2 best solutions below

0
On BEST ANSWER

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]
            };
  }
0
On

The sample projects for ComponentOne FlexGrid include a Hyperlink sample. Should be part of your installed items.

If not, you can also access it via the ComponentOne website.

Essentially, you set up a style for the hyperlink cells/columns and apply it. You can use OwnerDrawCell events to do it, as the example shows.