Home Forums WinForms controls Xceed Grid for WinForms adding image dynamically

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

    I have a grid with 4 bound columns, I wish to display an image in front of the row which is selected by the user. How can i capture the click event on the grid and display image dynamically.

    thx

    Imported from legacy forums. Posted by anac2112 (had 4026 views)

    Xceed Support
    Member
    Post count: 5658

    You could use the RowSelectorPane to get the wanted behavior. The following code will display the image in the RowSelector.

    <code>
    ImageList list = new ImageList();
    list.Images.Add( new Bitmap( @”D:\myImage.jpg” ) );
    gridControl1.RowSelectorPane.ImageList = list;
    gridControl1.RowSelectorPane.CurrentImageIndex = 0;
    </code>

    Imported from legacy forums. Posted by CharlesB (had 223 views)

    User (Old forums)
    Member
    Post count: 23064

    Sorry didnot mention that I am working with xceed grid. Cannot find RowSelectorPane property for xceed grid. Also cannot find class ImageList.

    Imported from legacy forums. Posted by anac2112 (had 239 views)

    Xceed Support
    Member
    Post count: 5658

    With which version of the Grid are you working? This sample was created using the 3.7.8113.16100 version of the Grid.

    Imported from legacy forums. Posted by CharlesB (had 241 views)

    User (Old forums)
    Member
    Post count: 23064

    Thx for ur prompt replies.. I am using version 3.6.

    Also let me know on which event I will be writing this code. How to capture Click on the specific row of a grid

    Imported from legacy forums. Posted by anac2112 (had 267 views)

    Xceed Support
    Member
    Post count: 5658

    You need to subscribe to each cell to get the Click event. After, through the sender, you can access the ParentRow.

    <code>
    private void Form1_Load( object sender, EventArgs e )
    {
    //…

    foreach( Cell cell in dataRowTemplate1.Cells )
    {
    cell.Click += new EventHandler( cell_Click );
    }
    }

    void cell_Click( object sender, EventArgs e )
    {
    //((Xceed.Grid.DataRow)((Cell)sender).ParentRow)
    }
    </code>

    Imported from legacy forums. Posted by CharlesB (had 5073 views)

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