可以参考下下面的代码。
- public class ImageCellFactory : CellFactory
- {
- public override void CreateCellContent(C1FlexGrid grid, System.Windows.Controls.Border bdr, CellRange rng)
- {
- base.CreateCellContent(grid, bdr, rng);
- if ((rng.Row == 1) && (rng.Column == 1))
- {
- var image = new Image();
- BitmapImage src = new BitmapImage(new Uri("../../myimage.png"));
- image.Source = src;
- bdr.Child = image;
- image.MouseLeftButtonDown += (s, e) =>
- {
- //do work here
- };
- }
- }
- }
- flex.CellFactory=new ImageCellFactory();
复制代码 |