Example #1
0
        public override Component DoBuildItemCell(TableGrid grid, TableRow row, int rowindex, int columnindex, PDFDataContext context)
        {
            TableCell cell = (TableCell)base.DoBuildItemCell(grid, row, rowindex, columnindex, context);
            DataImage dimg = new DataImage();

            cell.Contents.Add(dimg);
            dimg.DataBinding += new PDFDataBindEventHandler(dimg_DataBinding);

            return(cell);
        }
Example #2
0
        void dimg_DataBinding(object sender, PDFDataBindEventArgs args)
        {
            this.DataBind(args.Context);
            DataImage dimg = (DataImage)sender;

            if (null != this._autobindItemPath)
            {
                object val = AssertGetDataItemValue(this._autobindItemPath, args);
                this.ImageData = ConvertValueToBase64Data(val);
                this.ImageKey  = GetImageKey(args.Context);
            }

            dimg.Data     = this.ImageData;
            dimg.ImageKey = this.ImageKey;
            dimg.Visible  = this.Visible;
        }
        void link_DataBinding(object sender, PDFDataBindEventArgs args)
        {
            this.DataBind(args.Context);

            Link link = (Link)sender;

            if (null != this._autobindItemPath)
            {
                string href = AssertGetDataItemValue(_autobindItemPath, args) as string;
                if (!string.IsNullOrEmpty(href))
                {
                    this.Action = LinkAction.Uri;
                    this.File   = href;
                    this.Text   = href;
                }
            }
            link.Action         = this.Action;
            link.Destination    = this.Destination;
            link.DestinationFit = this.DestinationFit;
            link.File           = this.File;
            link.NewWindow      = this.NewWindow;
            link.Visible        = this.Visible;


            if (null != this.ImageData)
            {
                DataImage dimg = new DataImage();
                dimg.Data = this.ImageData;
                link.Contents.Add(dimg);
            }
            else if (!string.IsNullOrEmpty(this.ImageSource))
            {
                Image image = new Image();
                image.Source = this.ImageSource;
                link.Contents.Add(image);
            }
            else if (!string.IsNullOrEmpty(this.Text))
            {
                Label lbl = new Label();
                lbl.Text = this.Text;
                link.Contents.Add(lbl);
            }
        }